
    f3fiX                     j    d Z ddlZddlZddlmZ er	 ddlmZ ddl	m
Z d ZddZy# e$ r eZY w xY w)	zBClient configuration for OpenTelemetry integration with LangSmith.    N)TYPE_CHECKINGTracerProvider)utilsc                      	 ddl m}  ddlm}m} ddlm} ddlm} | ||||fS # t        $ r"}t        j                  d|        Y d}~yd}~ww xY w)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         c/var/www/auto_recruiter/arenv/lib/python3.12/site-packages/langsmith/_internal/otel/_otel_client.py_import_otel_clientr      se    	
	
 	;	

 
 	
  PQRPST	
 	s    # 	AA		Ac                  $   t               } | t        d      | \  }}}}}dt        j                  vr+t	        j
                  d      }| dt        j                  d<   dt        j                  vrKt	        j                  d      }d| }t	        j                         }	|	r|d|	 z  }|t        j                  d<   t        j                  j                  dd	      }
 |||
d
di      } ||      } |       } ||      }|j                  |       |S )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   ( 22