
    iX                     x    S r SSKrSSKrSSKJr  \(       a   SSKJr  SSK	J
r  S rSS jrg! \ a    \r Nf = f)	zBClient configuration for OpenTelemetry integration with LangSmith.    N)TYPE_CHECKINGTracerProvider)utilsc                       SSK Jn   SSKJnJn  SSKJn  SSKJn  U UUUU4$ ! [         a#  n[        R                  " SU 35         SnAgSnAff = f)z3Dynamically import OTEL client modules when needed.r   )OTLPSpanExporter)SERVICE_NAMEResourcer   )BatchSpanProcessorzBOTEL_ENABLED is set but OpenTelemetry packages are not installed: N)5opentelemetry.exporter.otlp.proto.http.trace_exporterr   opentelemetry.sdk.resourcesr	   r
   opentelemetry.sdk.tracer   opentelemetry.sdk.trace.exportr   ImportErrorwarningswarn)r   r	   r
   r   r   es         _/home/james-whalen/.local/lib/python3.13/site-packages/langsmith/_internal/otel/_otel_client.py_import_otel_clientr      se    	
	
 	;	

 
 	
  PQRPST	
 	s    # 
AAAc                  0   [        5       n U c  [        S5      eU u  nnnnnS[        R                  ;  a,  [        R
                  " S5      nU S3[        R                  S'   S[        R                  ;  aR  [        R                  " S5      nSU 3n[        R                  " 5       n	U	(       a  USU	 3-  nU[        R                  S'   [        R                  R                  SS	5      n
U" X*S
S0S9nU" US9nU" 5       nU" U5      nUR                  U5        U$ )a  Get the OTLP tracer provider for LangSmith.

This function creates a tracer provider that exports spans using the OTLP protocol
with LangSmith-specific defaults:

- OTEL_EXPORTER_OTLP_ENDPOINT: https://api.smith.langchain.com/otel
- OTEL_EXPORTER_OTLP_HEADERS: Contains x-api-key from LangSmith API key and
  Langsmith-Project header if project is configured

These defaults can be overridden by setting the environment variables before
calling this function.

Returns:
    TracerProvider: The OTLP tracer provider.
NzkOpenTelemetry packages are required to use this function. Please install with `pip install langsmith[otel]`OTEL_EXPORTER_OTLP_ENDPOINTz/otelOTEL_EXPORTER_OTLP_HEADERSz
x-api-key=z,Langsmith-Project=OTEL_SERVICE_NAME	langsmithzlangsmith.internal_providerT)
attributes)resource)
r   r   osenvironls_utilsget_api_urlget_api_keyget_tracer_projectgetadd_span_processor)otel_importsr   r	   r
   r   r   ls_endpointapi_keyheadersprojectservice_namer   tracer_providerotlp_exporterspan_processors                  r   get_otlp_tracer_providerr.   -   s,   " '(L@
 	
 	 %BJJ6**407Bm54I

01 $2::5&&t,wi(--/,WI66G3:

/0::>>"5{CL)4
H %h7O$&M'6N&&~6    )returnr   )__doc__r   r   typingr   r   r   r   objectr   r   r   r   r.    r/   r   <module>r5      sB    H 	    : (:=G    s   . 99