Ë
    tPêjÓª  ã            	       óZ  — U d Z ddlmZ ddlmZmZmZmZ ddlm	Z	 ddl
m
Z
 ddlmZmZmZmZ ddlmZmZmZ ddlmZ dd	lmZ dd
lmZmZmZmZmZmZmZ ddl Z ddl!m"Z" ddl#m$Z$ ddl%m&Z&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/m0Z0m1Z1m2Z2 ddl3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z; ddl<m=Z= ddl>m?Z?m@Z@ ddlAmBZB ddlCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZK ddlLmMZM ddlNmOZOmPZP ddlQmRZRmSZSmTZTmUZUmVZVmWZW ddlXmYZY er"ddlZm[Z[ ddl\m]Z] ddl^m_Z_ ddl`maZa dd lbmcZcmdZdmeZe d!Zfeegd"<   ddd#œd$d%d&ehdz  d'eidz  d(e9fd)„Zjd*Zkeegd+<   d,Zleegd-<   d.edz  d(emed/f   dz  fd0„Zn G d1„ d2«      Zo G d3„ d4e$«      Zp	 dCd5eeq   d6d7d(d4fd8„Zr	 dCd5eeq   d9eegdf   d6d7d(d4fd:„ZsdDd;„ZtdEd<„ZudCd=eqd>eidz  d(dfd?„Zve	d@eid(dAfdB„«       Zwy)Fz:``CustomLogger`` adapter on the OpenTelemetry span engine.é    )ÚOrderedDict)ÚCallableÚIteratorÚMappingÚSequence)Úcontextmanager)Údatetime)ÚTYPE_CHECKINGÚAnyÚFinalÚcast)ÚContextÚattachÚget_current)ÚLoggerProvider)ÚTracerProvider)ÚINVALID_SPANÚLinkÚSpanÚTracerÚget_current_spanÚset_span_in_contextÚuse_spanN)Úverbose_logger)ÚCustomLogger)ÚSpanEmitterÚstamp_error)Úresolve_mappers)Úpromoted_baggage)ÚOpenTelemetryV2Config)ÚLLMCallEventÚRequestIdentityÚauth_metadataÚmodel_from_request_data)ÚGuardrailSpanDataÚLLMCallSpanDataÚMCPListToolsSpanDataÚMCPToolCallSpanDataÚServiceSpanDataÚ	SpanErrorÚis_mcp_list_toolsÚis_mcp_tool_call)ÚError)ÚSpanRoleÚspan_role_for_service)Úto_ns)Úis_recordable_spanÚmcp_message_transport_spanÚrequest_root_spanÚresolve_mcp_span_contextÚresolve_parent_contextÚresolve_request_span_contextÚset_request_baggageÚset_request_root_span)ÚGenAIEventRecorder)ÚGenAIMetricRecorderÚcreate_genai_metrics)Úbuild_tracer_providerÚget_event_loggerÚ	get_meterÚ
get_tracerÚresolve_logger_providerÚresolve_meter_provider)ÚTenantTracerCache)ÚMeterProvider)Ú	DualCache)ÚUserAPIKeyAuth)ÚServiceLoggerPayload)ÚCallTypesLiteralÚ#StandardLoggingGuardrailInformationÚStandardLoggingPayloadÚlitellmÚLITELLM_TRACER_NAME)Ústatus_codeÚtraceback_strÚ	exceptionúException | NonerL   rM   Úreturnc          	      óR  — ddl m} |j                  | |¬«      }t        |j	                  d«      xs |j	                  d«      xs d|j	                  d«      xs d|�t        |«      n|j	                  d«      xs d|j	                  d«      xs d|j	                  d	«      xs d¬
«      S )aa  A ``SpanError`` for a proxy-level failure that never produced a
    ``StandardLoggingPayload`` (auth / validation / malformed-body rejections),
    mirroring ``_parse_error``'s field mapping so it stamps the same v2 keys a
    failed LLM call does. ``status_code`` pins ``error.code`` to the real response
    status, matching v1's SERVER-span behavior.r   )ÚStandardLoggingPayloadSetup)Úoriginal_exceptionrM   Úerror_classÚ
error_codeNÚerror_messageÚ	tracebackÚllm_provider)Ú
error_typeÚmessageÚcodeÚstack_tracerX   )Ú*litellm.litellm_core_utils.litellm_loggingrR   Úget_error_informationr*   ÚgetÚstr)rN   rL   rM   rR   Úinfos        úe/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/litellm/integrations/otel/logger.pyÚ_span_error_from_exceptionrc   X   s£   € õ Wà-×CÑCØ$Ø#ð Dó €Dô Ø—8‘8˜MÓ*ÒL¨d¯h©h°|Ó.DÒLÈØ—‘˜Ó)Ò1¨TØ!,Ð!8ŒS�Ô¸t¿x¹xÈÓ?UÒ?]ÐY]Ø—H‘H˜[Ó)Ò1¨TØ—X‘X˜nÓ-Ò5°ôð ó    )zlitellm.integrations.otelz"litellm.integrations.opentelemetryÚ_OTEL_MODULESi'  Ú_OPEN_CALLS_MAXÚcontext.c                 óh   — t        | «      j                  «       }|j                  rt        |«      fS dS )zIA link back to the request trace, for a span detached into its own trace.N)r   Úget_span_contextÚis_validr   )rg   Úanchors     rb   Ú_request_trace_linksrl   ‚   s,   € ä$ WÓ-×>Ñ>Ó@€FØ$ŸošoŒD�‹Lˆ?Ð7°4Ð7rd   c            	       ó6   — e Zd ZdZdZ	 ddddedz  ddd	dfd
„Zy)Ú_LLMCallSpanuC  The state carried from the ``pre_call`` boundary to span close.

    ``span`` is the live span when it could be opened at the boundary (the server
    span was ambient), or ``None`` when creation was deferred because no ambient
    parent was visible â€” in which case the async callback creates it against its
    own (worker-copied) ambient context using ``start_time_ns``. The presence of
    a carrier for a call at all is the proof that ``pre_call`` ran, i.e. that an
    upstream call was actually attempted.

    ``provider`` is the routed provider the live span was opened on (``None`` on
    the default route or when creation was deferred). It is held in the tenant
    cache while the span is open so LRU eviction can't shut the provider down
    under it, and must be released exactly once when the carrier is removed.
    )ÚproviderÚspanÚstart_time_nsNrp   úSpan | Nonerq   ro   zTracerProvider | NonerP   c                 ó.   — || _         || _        || _        y ©N©rp   rq   ro   )Úselfrp   rq   ro   s       rb   Ú__init__z_LLMCallSpan.__init__š   s   € ð ˆŒ	Ø*ˆÔØ ˆ�rd   rt   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__Úintrw   © rd   rb   rn   rn   ˆ   sB   „ ñð 6€Ið -1ñ	!àð!ð ˜T‘zð!ð *ð	!ð
 
ô!rd   rn   c                   ó¤  ‡ — e Zd ZdZ	 	 	 	 	 dKdedz  dedz  dedz  dedz  ddd	ed
dfˆ fd„Z	dLd„Z
dedz  d
dfd„Zded
dfd„ZdMd„Zd„ Zd„ ZdMd„ZdMd„ZdNd„Zd„ Zdededz  ded
efd„Zd	eeef   deez  dz  deez  dz  d
efd„Zd	eeef   deez  dz  deez  dz  d
efd„Zd	eeef   deez  dz  deez  dz  d
edz  fd „Z d!ed"e!d
dfd#„Z"dOd%„Z#d"d$d&e$deez  dz  deez  dz  d
edz  f
d'„Z%	 	 	 	 dPd(d)d*edz  deez  dz  deez  dz  d+e&dz  d
dfd,„Z'	 	 	 	 	 dQd(d)d-edz  d*edz  deez  dz  deez  dz  d+e&dz  d
dfd.„Z(d(d)d*edz  deez  dz  deez  dz  d+e&dz  d/edz  d
edz  fd0„Z)dRd1ededz  d
dfd2„Z*e+d3ed
d4fd5„«       Z,d1d6d7d8d9e&d:d;d
e&f
d<„Z-d=d>d?d@dAe.d
dfdB„Z/	 dRdCe&dDe0d1d6dEdFd
df
dG„Z1dSdH„Z2dedIeeef   dz  d
edz  fdJ„Z3ˆ xZ4S )TÚOpenTelemetryV2z'The ``CustomLogger`` for OpenTelemetry.NÚconfigÚcallback_nameÚtracer_providerÚlogger_providerÚmeter_providerúMeterProvider | NoneÚkwargsrP   c                 ó4  •— t        ‰| �  di |¤Ž |xs t        di |¤Ž| _        || _        |�|nt        | j                  «      | _        t        | j                  t        «      | _	        | j                  |«      | _        d| _        t        | j                  | j                  t        | j                  j                  «      | j!                  |«      ¬«      | _        t%        | j                  |t        «      | _        t)        «       | _        | j-                  «        y )NF)ÚmappersÚevent_recorderr~   )Úsuperrw   r    r�   r‚   r<   Ú_tracer_providerr?   rK   ÚtracerÚ_init_metricsÚ_metrics_recorderÚ_metric_filter_error_loggedr   r   Úmapper_namesÚ_init_eventsÚ_emitterrB   Ú_tenant_tracersr   Ú_open_llm_callsÚ"_init_otel_logger_on_litellm_proxy)rv   r�   r‚   rƒ   r„   r…   r‡   Ú	__class__s          €rb   rw   zOpenTelemetryV2.__init__¨   së   ø€ ô 	‰ÑÑ"˜6Ò"Ø-3Ò-VÔ7LÑ7VÈvÑ7VˆŒØ*ˆÔà.Ð:‰OÔ@UÐVZ×VaÑVaÓ@bð 	Ôô )¨×)>Ñ)>Ô@SÓTˆŒØ!%×!3Ñ!3°NÓ!CˆÔØ+0ˆÔ(Ü#Ø�K‰KØ�K‰KÜ# D§K¡K×$<Ñ$<Ó=Ø×,Ñ,¨_Ó=ô	
ˆŒô  1°·±¸mÔM`ÓaˆÔÜ?J»}ˆÔØ×/Ñ/Õ1rd   c                 óº   — | j                   j                  syt        | j                   |«      }t        |t        «      }t        t        |«      | j                  «      S )ao  Create the six GenAI histograms when metrics are enabled, else ``None``.

        ``meter_provider`` is an explicit override (tests inject one); otherwise the
        provider is resolved from the OTel global so the operator's configured
        readers/exporters receive the metrics, building and registering one only
        when no global provider is set.
        N)r�   Úenable_metricsrA   r>   rK   r:   r;   r‚   )rv   r…   ro   Úmeters       rb   rŽ   zOpenTelemetryV2._init_metricsÄ   sJ   € ð �{‰{×)Ò)ØÜ0°·±¸nÓMˆÜ  Ô+>Ó?ˆÜ"Ô#7¸Ó#>À×@RÑ@RÓSÐSrd   zGenAIEventRecorder | Nonec                 ó”   — | j                   j                  syt        | j                   |«      }|€yt        t	        |t
        «      «      S )aÐ  Create the GenAI event recorder when events are enabled, else ``None``.

        ``logger_provider`` is an explicit override (tests inject one); otherwise the
        provider is resolved from the OTel global so an operator-configured logs
        pipeline receives the events, building and registering one only when no
        global provider is set. A ``None`` resolution means the operator opted out
        of the logs signal, so no recorder is built.
        N)r�   Úenable_eventsr@   r9   r=   rK   )rv   r„   ro   s      rb   r’   zOpenTelemetryV2._init_eventsÒ   sA   € ð �{‰{×(Ò(ØÜ1°$·+±+¸ÓOˆØÐØÜ!Ô"2°8Ô=PÓ"QÓRÐRrd   Ú	callbacksc                 óP   — t        d„ |D «       «      }|s|j                  | «       y y )Nc              3   óˆ   K  — | ]:  }t        |d «      sŒ|j                  j                  j                  t        «      –— Œ< y­w)r—   N)Úhasattrr—   ry   Ú
startswithre   ©Ú.0Úcbs     rb   ú	<genexpr>z=OpenTelemetryV2._register_in_callback_list.<locals>.<genexpr>ç   s6   è ø€ ò "
ØBDÔU\Ð]_ÐalÕUmˆB�L‰L×#Ñ#×.Ñ.¬}×=ñ"
ùs
   ‚A”.A)ÚanyÚappend)rv   r�   Úalready_otels      rb   Ú_register_in_callback_listz*OpenTelemetryV2._register_in_callback_listæ   s1   € Ü!ñ "
ØHQô"
ó 
ˆñ Ø×Ñ˜TÕ"ð rd   c                 ó~  — 	 ddl m} 	 | j                  t        j
                  «       | j                  t        j                  «       | j                  t        j                  «       | j                  t        j                  «       t        |dd «      €t        |d| «       y y # t        $ r Y y w xY w# t        $ r Y Œ6w xY w©Nr   )Úproxy_serverÚopen_telemetry_logger)Úlitellm.proxyr¬   Ú	Exceptionr©   rJ   Úservice_callbackÚinput_callbackÚ_async_success_callbackÚ_async_failure_callbackÚgetattrÚsetattr)rv   r¬   s     rb   r–   z2OpenTelemetryV2._init_otel_logger_on_litellm_proxyí   s«   € ð	Ý2ð	Ø×+Ñ+¬G×,DÑ,DÔEØ×+Ñ+¬G×,BÑ,BÔCØ×+Ñ+¬G×,KÑ,KÔLØ×+Ñ+¬G×,KÑ,KÔLô �<Ð!8¸$Ó?ÐGÜ�LÐ"9¸4Õ@ð Høô ò 	Ùð	ûô ò 	Ùð	ús#   ‚B! ‰A<B0 Â!	B-Â,B-Â0	B<Â;B<c           
      óP  — t        j                  |«      }|j                  ry|j                  }|€y|| j                  v ryt        t        j                  «       «      }t        «       }t        t        |«      «      s| j                  |t        d|¬«      «       y| j                  j                  | j                  |j                   |j"                  «      }	 | j$                  j'                  t(        j*                  |j,                  |j.                  rt1        t2        |«      n|||j                  |j.                  rt5        |«      nd¬«      }	| j                  |t        |	||j:                  ¬«      «       y# t6        $ r' | j                  j9                  |j:                  «       ‚ w xY w)u$  Open the LLM-call span at the call boundary.

        Runs synchronously inside the request task, before the upstream call â€”
        the one place where the live server span is genuinely the ambient OTel
        context â€” so the span parents to it natively, with no span threaded
        through a metadata dict. The open span is stashed on the per-request
        ``LiteLLMLoggingObj`` (a typed object) and closed in the async callback.

        When no recordable parent is visible (``pre_call`` was driven from a thread
        pool for a sync-only provider, where contextvars â€” and so the anchor â€”
        don't follow), creation is deferred: only the start time is recorded, and
        the async callback â€” whose worker context was copied from the request task
        and so still carries the anchor â€” creates the span then.

        Synthetic proxy-gate error logs (auth/rate-limit rejections) also fire this
        hook but never made an upstream call; they are tagged and skipped so no
        phantom LLM-call span is produced.
        N)rp   rq   )Úparent_contextrq   r�   Úlinksru   )r!   Ú	from_dictÚis_no_upstream_callÚcall_idr•   r0   r	   Únowr6   r1   r   Ú_store_open_callrn   r”   Ú	route_forr�   Údynamic_paramsr#   r“   Ú
start_spanr.   ÚLLM_CALLÚprovisional_span_nameÚdetachedr   r   rl   ÚBaseExceptionÚreleasero   )
rv   ÚmodelÚmessagesr‡   Úcallr»   rq   r·   Úrouterp   s
             rb   Úlog_pre_api_callz OpenTelemetryV2.log_pre_api_call  sc  € ô& #×,Ñ,¨VÓ4ˆØ×#Ò#ØØŸ™ˆØˆ?Øð �d×*Ñ*Ñ*ØÜ$¤X§\¡\£^Ó4ˆô !=Ó >ˆÜ!Ô"2°>Ó"BÔCØ×!Ñ! '¬<¸TÐQ^Ô+_Ô`Øð ×+Ñ+×5Ñ5°d·k±kÀ4×CVÑCVÐX\×XjÑXjÓkˆð	ØŸ-™-×2Ñ2Ü×!Ñ!Ø×*Ñ*àINÏÊÔ'¬°nÔEÐ]kà+Ø—|‘|Ø>C¿nºnÔ*¨>Ô:ÐRVð 3ó 	ˆDð 	×ÑØÜ˜d°-È%Ï.É.ÔYõ	
øô ò 	Ø× Ñ ×(Ñ(¨¯©Ô8Øð	ús   ÃA6E5 Å50F%c              ƒ   óª   K  — | j                  |||«      ry | j                  |||«      ry | j                  |||«       | j                  ||||«       y ­wrt   )Ú_emit_mcp_tool_callÚ_emit_mcp_list_toolsÚ_close_llm_callÚ_record_metrics©rv   r‡   Úresponse_objÚ
start_timeÚend_times        rb   Úasync_log_success_eventz'OpenTelemetryV2.async_log_success_event?  sV   è ø€ Ø×#Ñ# F¨J¸ÔAØØ×$Ñ$ V¨Z¸ÔBØØ×Ñ˜V Z°Ô:Ø×Ñ˜V \°:¸xÕHùs   ‚AAc                 ó:   ‡‡‡‡— | j                  ˆˆˆˆfd„«       y)z3Record the GenAI metrics for a successful LLM call.c                 ó,   •— | j                  ‰‰‰‰«      S rt   )Úrecord)ÚrecorderrÓ   r‡   rÑ   rÒ   s    €€€€rb   ú<lambda>z1OpenTelemetryV2._record_metrics.<locals>.<lambda>I  s   ø€ ¨h¯o©o¸fÀlÐT^Ð`hÓ.i€ rd   N)Ú_guarded_recordrÐ   s    ````rb   rÏ   zOpenTelemetryV2._record_metricsG  s   û€ à×ÑÖiÕjrd   c                 óv   ‡‡‡— t        j                  ‰«      j                  ry| j                  ˆˆˆfd„«       y)a~  Record the GenAI metrics for a failed LLM call, so the duration
        histogram covers the whole traffic rather than only what survived.

        A synthetic proxy-gate log (auth / rate-limit rejection) is skipped for the
        same reason it gets no span: no upstream call happened, so its duration is
        not a GenAI operation's duration and would pull the histogram down.Nc                 ó*   •— | j                  ‰‰‰«      S rt   )Úrecord_failure)rØ   rÓ   r‡   rÒ   s    €€€rb   rÙ   z9OpenTelemetryV2._record_failure_metrics.<locals>.<lambda>T  s   ø€ ¨h×.EÑ.EÀfÈjÐZbÓ.c€ rd   )r!   r¹   rº   rÚ   )rv   r‡   rÒ   rÓ   s    ```rb   Ú_record_failure_metricsz'OpenTelemetryV2._record_failure_metricsK  s+   ú€ ô ×!Ñ! &Ó)×=Ò=ØØ×ÑÕcÕdrd   c                 ó  — | j                   €y	  || j                   «       y# t        $ r8}| j                  s"t        j                  d|«       d| _        Y d}~yY d}~yd}~wt
        $ r }t        j                  d|«       Y d}~yd}~ww xY w)a  Run one metric recording. Best-effort: a recording failure (e.g. a
        malformed payload) must never break the span close or the request itself. A
        misconfigured attribute filter is operator-fixable, so it is surfaced once
        at ERROR instead of being swallowed.NzLOpenTelemetryV2: invalid otel.attributes metric filter, metrics disabled: %sTz,OpenTelemetryV2: metric recording failed: %s)r�   Ú
ValueErrorr�   r   Úerrorr¯   Údebug)rv   r×   Úexcs      rb   rÚ   zOpenTelemetryV2._guarded_recordV  sˆ   € ð
 ×!Ñ!Ð)Øð
	VÙ�4×)Ñ)Õ*øÜò 	8Ø×3Ò3Ü×$Ñ$ØbØôð 48�×0Ñ0ô 4ûô ò 	VÜ× Ñ Ð!OÐQT×UÑUûð	Vús    �" ¢	B
«)AÁB
Á*BÂB
c              ƒ   ó¨   K  — | j                  |||«      ry | j                  |||«      ry | j                  |||«       | j                  |||«       y ­wrt   )rÌ   rÍ   rÎ   rÞ   rÐ   s        rb   Úasync_log_failure_eventz'OpenTelemetryV2.async_log_failure_eventi  sT   è ø€ Ø×#Ñ# F¨J¸ÔAØØ×$Ñ$ V¨Z¸ÔBØØ×Ñ˜V Z°Ô:Ø×$Ñ$ V¨Z¸ÕBùs   ‚AAÚidentityrÆ   rg   c           	      óò   — t        ||t        | j                  j                  «      t        | j                  j                  «      t        | j                  j
                  «      ¬«      }|rt        ||¬«      S |S )a  Seed authenticated request-identity Baggage onto ``context`` so the Baggage
        processor stamps team/key/metadata onto the span. Identity is read from the
        parsed payload, never the client's ``params._meta`` carrier, so it can't be
        spoofed.©Úpromoted_keysÚmetadata_keysÚteam_metadata_keys©rg   )r   Útupler�   Úbaggage_promoted_keysÚbaggage_metadata_keysÚbaggage_team_metadata_keysr7   )rv   ræ   rÆ   rg   Úbags        rb   Ú_seed_identity_baggagez&OpenTelemetryV2._seed_identity_baggageq  sb   € ô
 &ØØÜ §¡× AÑ AÓBÜ §¡× AÑ AÓBÜ$ T§[¡[×%KÑ%KÓLô
ˆñ =@Ô" 3°Ô8ÐLÀWÐLrd   rÒ   rÓ   c                 óþ  — |j                  d«      }|r&t        t        t        t        t
        f   |«      «      syt        d|«      }t        j                  || j                  j                  ¬«      }|j                  j                  r?| j                  | j                  j                  |j                  j                  d«      «       | j                  j!                  | j"                  dt%        ||«      «      }	 t'        «       \  }}	| j)                  |j                  d|«      }
| j*                  j-                  t.        j0                  ||j2                  rt5        t6        |
«      n|
t9        |«      t9        |«      |j2                  rg |	xs d¢t;        |
«      xs d¢­n|	|j"                  ¬«       | j                  j=                  |j>                  «       y# | j                  j=                  |j>                  «       w xY w)	u×  Emit an MCP tool-call span when the closed request was a tool call.

        MCP tool calls reach the success/failure callbacks like any other request
        (with ``call_type`` ``call_mcp_tool``), but they are not LLM calls and have
        no ``pre_call`` carrier â€” so they get their own CLIENT span here. It nests
        under the transport span of the request carrying this message, and trace
        context the client propagated in ``params._meta`` is recorded as a span
        link (see ``resolve_mcp_span_context``). Returns whether it handled the
        event, so the caller skips the LLM-call path. The whole span is emitted at
        once (there is no boundary to open it at), deduped on the call id.
        Ústandard_logging_objectFrI   ©Úcapture_contentNr~   ©r·   rq   Úend_time_nsr¸   r�   T) r_   r,   r   r   r`   Úobjectr(   Úfrom_standard_logging_payloadr�   Úcapture_span_contentræ   r»   Ú_release_carrierr•   Úpopr”   r¾   r�   r#   r4   rò   r“   Úemitr.   ÚMCP_TOOL_CALLrÃ   r   r   r0   rl   rÅ   ro   ©rv   r‡   rÒ   rÓ   Úraw_payloadÚpayloadÚdatarÉ   r·   r¸   Úseededs              rb   rÌ   z#OpenTelemetryV2._emit_mcp_tool_call  s—  € ð" $ŸZ™ZÐ(AÓBˆÙÔ"2´4¼ÄÄVÀÑ8LÈkÓ3ZÔ"[ØÜÐ6¸ÓDˆÜ)×GÑGØ T§[¡[×%EÑ%Eô
ˆð �=‰=× Ò Ø×!Ñ! $×"6Ñ"6×":Ñ":¸4¿=¹=×;PÑ;PÐRVÓ"WÔXØ×+Ñ+×5Ñ5°d·k±kÀ4ÌÐW^Ð`fÓIgÓhˆð	9Ü$<Ó$>Ñ!ˆN˜EØ ×7Ñ7¸¿¹ÀtÈ^Ó\ˆFØ�M‰M×ÑÜ×&Ñ&ØØMRÏ^Ê^Ô 3´LÀ&Ô IÐagÜ# JÓ/Ü! (›OØRW×R`ÒR`ÐN˜%š+ 2ÐNÔ*>¸vÓ*FÒ*LÈ"ÒNÐfkØ—|‘|ð ô ð × Ñ ×(Ñ(¨¯©Ô8Øøð × Ñ ×(Ñ(¨¯©Õ8úó   Ã9B6G Ç'G<c                 óþ  — |j                  d«      }|r&t        t        t        t        t
        f   |«      «      syt        d|«      }t        j                  || j                  j                  ¬«      }|j                  j                  r?| j                  | j                  j                  |j                  j                  d«      «       | j                  j!                  | j"                  dt%        ||«      «      }	 t'        «       \  }}	| j)                  |j                  d|«      }
| j*                  j-                  t.        j0                  ||j2                  rt5        t6        |
«      n|
t9        |«      t9        |«      |j2                  rg |	xs d¢t;        |
«      xs d¢­n|	|j"                  ¬«       | j                  j=                  |j>                  «       y# | j                  j=                  |j>                  «       w xY w)	a'  Emit an MCP ``tools/list`` span when the closed request was a discovery call.

        Like a tool call, listing reaches the success/failure callbacks (here with
        ``call_type`` ``list_mcp_tools``) with no ``pre_call`` carrier, so it gets its
        own CLIENT span, nested under the transport span of the request carrying
        this message with any ``params._meta`` trace context recorded as a span
        link (see ``resolve_mcp_span_context``). Returns whether it handled the event so
        the caller skips the LLM-call path.
        rô   FrI   rõ   Nr~   r÷   T) r_   r+   r   r   r`   rù   r'   rú   r�   rû   ræ   r»   rü   r•   rý   r”   r¾   r�   r#   r4   rò   r“   rþ   r.   ÚMCP_LIST_TOOLSrÃ   r   r   r0   rl   rÅ   ro   r   s              rb   rÍ   z$OpenTelemetryV2._emit_mcp_list_tools­  s—  € ð $ŸZ™ZÐ(AÓBˆÙÔ"3´D¼ÄÄfÀÑ9MÈ{Ó4[Ô"\ØÜÐ6¸ÓDˆÜ*×HÑHØ T§[¡[×%EÑ%Eô
ˆð �=‰=× Ò Ø×!Ñ! $×"6Ñ"6×":Ñ":¸4¿=¹=×;PÑ;PÐRVÓ"WÔXØ×+Ñ+×5Ñ5°d·k±kÀ4ÌÐW^Ð`fÓIgÓhˆð	9Ü$<Ó$>Ñ!ˆN˜EØ ×7Ñ7¸¿¹ÀtÈ^Ó\ˆFØ�M‰M×ÑÜ×'Ñ'ØØMRÏ^Ê^Ô 3´LÀ&Ô IÐagÜ# JÓ/Ü! (›OØRW×R`ÒR`ÐN˜%š+ 2ÐNÔ*>¸vÓ*FÒ*LÈ"ÒNÐfkØ—|‘|ð ô ð × Ñ ×(Ñ(¨¯©Ô8Øøð × Ñ ×(Ñ(¨¯©Õ8úr  c                 óJ  — t        j                  |«      }|j                  }|r| j                  j	                  |d«      nd}|€%|j
                  s|j                  r|j                  €y	 | j                  ||||«      | j                  |«       S # | j                  |«       w xY w)u?  Finish the LLM-call span opened at ``pre_call`` (or create it deferred).

        No carrier for this call id means ``pre_call`` never ran â€” the request was
        rejected at the gate or blocked by a pre-call guardrail before any upstream
        call â€” so there is nothing to record and no phantom span.
        N)
r!   r¹   r»   r•   rý   rº   Úupstream_startedr  Ú_finish_carrierrü   )rv   r‡   rÒ   rÓ   rÈ   r»   Úcarriers          rb   rÎ   zOpenTelemetryV2._close_llm_callÖ  sœ   € ô #×,Ñ,¨VÓ4ˆØŸ™ˆñ EL˜×-Ñ-×1Ñ1°'¸4Ô@ÐQUˆð ˆ? × 8Ò 8À×@UÒ@UÐY]×YeÑYeÐYmØð	+Ø×'Ñ'¨°°zÀ8ÓLð ×!Ñ! 'Õ*øˆD×!Ñ! 'Õ*ús   Á*B ÂB"r»   r  c                 ó¼   — || j                   |<   t        | j                   «      t        kD  r1| j                   j                  d¬«      \  }}| j	                  |«       yy)a5  Remember an in-flight LLM call, evicting the oldest if over budget.

        A call that opens but never closes (a stream that only fires stream
        events) would linger otherwise. Eviction only drops the boundary carrier,
        not the call: if that call later closes as a real completed call, it still
        emits through the deferred branch in ``_close_llm_call`` (the same path a
        team/key-scoped logger uses, since it never opens a carrier), deduplicated
        by call id. Only a call that is evicted and never closes goes unexported.
        F)ÚlastN)r•   Úlenrf   Úpopitemrü   )rv   r»   r  Ú_Úevicteds        rb   r½   z OpenTelemetryV2._store_open_callõ  sW   € ð )0ˆ×Ñ˜WÑ%Üˆt×#Ñ#Ó$¤Ò6Ø×-Ñ-×5Ñ5¸5Ð5ÓA‰JˆAˆwØ×!Ñ! 'Õ*ð 7rd   ú_LLMCallSpan | Nonec                 óT   — |�&| j                   j                  |j                  «       yy)z?Release the routed provider a removed carrier was holding open.N)r”   rÅ   ro   )rv   r  s     rb   rü   z OpenTelemetryV2._release_carrier  s'   € àÐØ× Ñ ×(Ñ(¨×)9Ñ)9Õ:ð rd   rÈ   c                 óæ  — |j                   }|j                  }|€^|�[|j                  �O| j                  j	                  |t
        j                  «       |j                  j                  t        |«      ¬«       y t        j                  || j                  j                  |j                  ¬«      }t        |«      }|�y|j                  �m| j                  j	                  |t
        j                  «       | j                  j                  t
        j                  |j                  ||¬«       |j                  S | j                  j!                  | j"                  |j$                  |j&                  «      }		 | j)                  |j*                  |j,                  t/        «       «      }
| j                  j1                  t
        j                  ||	j2                  rt5        t6        |
«      n|
|�|j8                  n
t        |«      ||	j"                  |	j2                  rt;        |
«      nd ¬«      | j                  j=                  |	j>                  «       S # | j                  j=                  |	j>                  «       w xY w)N)rÓ   )rö   Útime_to_first_chunk_seconds)rø   )r·   rq   rø   r�   r¸   ) r  r»   rp   r“   Úmark_emittedr.   rÁ   Úendr0   r&   rú   r�   rû   r  Úfinish_spanr”   r¾   r�   r¿   r#   rò   ræ   Úrequest_modelr6   rþ   rÃ   r   r   rq   rl   rÅ   ro   )rv   r  rÈ   rÒ   rÓ   r  r»   r  rø   rÉ   Ú
parent_ctxs              rb   r
  zOpenTelemetryV2._finish_carrier	  sè  € ð Ÿ™ˆØŸ™ˆØˆ?ØÐ" w§|¡|Ð'?ð
 —‘×*Ñ*¨7´H×4EÑ4EÔFØ—‘× Ñ ¬%°«/Ð Ô:ØÜ%×CÑCØØ ŸK™K×<Ñ<Ø(,×(HÑ(Hô
ˆô
 # 8›_ˆØÐ 7§<¡<Ð#;ð �M‰M×&Ñ& w´×0AÑ0AÔBØ�M‰M×%Ñ%¤h×&7Ñ&7¸¿¹ÀtÐYdÐ%ÔeØ—<‘<Ðð ×+Ñ+×5Ñ5°d·k±kÀ4×CVÑCVÐX\×XjÑXjÓkˆð	9Ø $× ;Ñ ;Ø—‘˜t×1Ñ1Ô3OÓ3Qó!ˆJð —=‘=×%Ñ%Ü×!Ñ!ØØQV×Q_ÒQ_Ô 3´LÀ*Ô MÐeoØ8?Ð8K˜w×4Ò4ÔQVÐWaÓQbØ'Ø—|‘|Ø:?¿.º.Ô*¨:Ô6Èdð &ó ð × Ñ ×(Ñ(¨¯©Õ8øˆD× Ñ ×(Ñ(¨¯©Õ8ús   Å1B2I	 É	'I0r  rF   Úparent_otel_spanÚevent_metadatac              ƒ   ó:   K  — | j                  |||||d ¬«       y ­w)N©r  rÒ   rÓ   r  Úerror_override©Ú_emit_service)rv   r  r  rÒ   rÓ   r  s         rb   Úasync_service_success_hookz*OpenTelemetryV2.async_service_success_hookD  s-   è ø€ ð 	×ÑØØ-Ø!ØØ)Øð 	õ 	
ùs   ‚rá   c           	   ƒ   óB   K  — | j                  ||||||xs d¬«       y ­w)Nrá   r  r   )rv   r  rá   r  rÒ   rÓ   r  s          rb   Úasync_service_failure_hookz*OpenTelemetryV2.async_service_failure_hookU  s2   è ø€ ð 	×ÑØØ-Ø!ØØ)Ø Ò+ Gð 	õ 	
ùs   ‚r  c          	      óx  — t        j                  ||¬«      }t        |j                  «      }|€y |€|€|€|€y |�C|j                  €7t        |j                  |j
                  t        |¬«      |j                  ¬«      }t        |¬«      }	| j                  j                  |||	t        |«      t        |«      ¬«      S )N)r  )rZ   )Úservice_nameÚ	call_typerá   r  )Úthreaded©r·   rq   rø   )r)   Úfrom_payloadr/   r&  rá   r'  r*   r  r5   r“   rþ   r0   )
rv   r  r  rÒ   rÓ   r  r  r  Úroler·   s
             rb   r!  zOpenTelemetryV2._emit_serviceg  sÆ   € ô ×+Ñ+¨GÀNÔSˆô ,¨D×,=Ñ,=Ó>ˆØˆ<Øð Ð! jÐ&8¸XÐ=MÐRbÐRjØØÐ%¨$¯*©*Ð*<Ü"Ø!×.Ñ.ØŸ.™.Ü¨Ô7Ø#×2Ñ2ô	ˆDô !7Ð@PÔ QˆØ�}‰}×!Ñ!ØØØ)Ü 
Ó+Ü˜h›ð "ó 
ð 	
rd   Úuser_api_key_dictc           	      ó  — 	 t        j                  |«      }t        ||t        | j                  j
                  «      t        | j                  j                  «      t        | j                  j                  «      ¬«      }|rvt        t        |t        «       ¬«      «       t        «       xs
 t        «       }t        |«      r6t        |«       |j                  «       D ]  \  }}|j!                  ||«       Œ yyy# t"        $ r Y yw xY w)u\  Attach request-identity Baggage to the current context + server span.

        Seeding identity into Baggage makes **every** span emitted afterwards for
        this request â€” LLM call, guardrail, DB call â€” inherit it via
        ``LiteLLMBaggageSpanProcessor``. Called once at the auth boundary (as soon
        as the key resolves) so post-auth spans are labeled consistently; the
        Baggage rides the request task's contextvar from there on. Auth-internal
        DB lookups that run before the key is known stay unlabeled â€” identity
        isn't determined yet, which is correct.
        rè   rì   N)r"   Úfrom_user_api_key_authr   rí   r�   rî   rï   rð   r   r7   r   r3   r   r1   r8   ÚitemsÚset_attributer¯   )rv   r,  rÆ   ræ   rñ   Úserver_spanÚkeyÚvalues           rb   Úseed_request_identityz%OpenTelemetryV2.seed_request_identity›  sã   € ð	Ü-×DÑDÐEVÓWˆHÜ)ØØÜ# D§K¡K×$EÑ$EÓFÜ# D§K¡K×$EÑ$EÓFÜ#(¨¯©×)OÑ)OÓ#PôˆCñ ô Ô*¨3¼»ÔFÔGô &7Ó%8Ò%NÔ<LÓ<N�Ü% kÔ2ô
 *¨+Ô6Ø&)§i¡i£kò >™
˜˜UØ#×1Ñ1°#°uÕ=ñ>ð 3ð øô( ò 	Ùð	ús   ‚C2C7 Ã7	DÄDÚnamezIterator[Span]c              #   ó  K  — | j                   j                  t        j                  |«      }t	        |d¬«      5  	 |–— 	 d d d «       y # t
        $ r)}t        |«      rt        |t        |«      dd¬«       ‚ d }~ww xY w# 1 sw Y   y xY w­w)NT)Úend_on_exitF)Úrecord_eventÚ
set_status)	r“   rÀ   r.   ÚSERVICEr   r¯   r1   r   rc   )rv   r5  rp   rã   s       rb   Ústart_phase_spanz OpenTelemetryV2.start_phase_spanÆ  s‚   è ø€ à—m‘m×.Ñ.¬x×/?Ñ/?ÀÓFˆÜ�d¨Ô-ñ 	ðØ“
÷	ð 	øô ò Ü% dÔ+Ü Ô&@ÀÓ&EÐTYÐfkÕlØûðú÷	ð 	üs9   ‚8BºA?¼A
Á	BÁ
	A<Á$A7Á7A<Á<A?Á?BÂBrE   ÚcacherD   r  r'  rG   c              ƒ   óF   K  — | j                  |t        |«      ¬«       |S ­w©N)rÆ   )r4  r$   )rv   r,  r<  r  r'  s        rb   Úasync_pre_call_hookz#OpenTelemetryV2.async_pre_call_hookÑ  s-   è ø€ ð 	×"Ñ"ØÜ)¨$Ó/ð 	#ô 	
ð ˆùs   ‚!rp   rr   rN   rO   rL   c                 ó–   — |�t        |«      syt        j                  t        |dd«      xs dv }t	        |t        ||¬«      | ¬«       y)uê  Stamp the v2 error.* attributes on the FastAPI-owned SERVER span for a
        failure that dies before any LLM-call span exists (malformed body, auth /
        validation rejection). Called from the proxy's global exception handler via
        ``_close_dangling_otel_server_span``, which swallows the exception into a
        ``JSONResponse`` so the instrumentor never sees it and leaves the span
        ``UNSET``; the status is set here instead (v1 did the same from the handler)
        so a failed request reads as failed and not merely as a span carrying an
        error message. The instrumentor still owns the span's lifecycle, so this
        never ends it. The exception event is recorded only when nothing stamped
        this span already â€” ``async_post_call_failure_hook`` and the ``auth`` phase
        span record their own, and a second event would duplicate it â€” while the
        attributes are always restamped so ``error.code`` stays pinned to the real
        response status.NÚ
attributesr~   )rL   )r8  )r1   r-   ÚTYPEr´   r   rc   )rv   rp   rN   rL   Úalready_stampeds        rb   Úrecord_error_attributes_on_spanz/OpenTelemetryV2.record_error_attributes_on_spanÞ  sL   € ð& ˆ<Ô1°$Ô7ØÜ!&§¡´¸¸lÈDÓ0QÒ0WÐUWÐ!XˆÜØÜ& y¸kÔJØ,Ð,ö	
rd   Úrequest_datarS   rM   z
str | Nonec              ƒ   óž   K  — t        «       xs t        «       xs |j                  }|�t        |«      syt	        |t        ||¬«      «       y­w)aD  Stamp error.* on the request's root SERVER span for a proxy-level
        failure that never reached an LLM call (empty body rejected in the
        endpoint, auth failure), so the failed request carries the same error keys
        a failed LLM call does. v1's ``OpenTelemetry`` implemented this same hook;
        v2 lost it when it stopped subclassing ``OpenTelemetry``, which is the
        LIT-4179 regression for pre-call failures.

        An MCP message is handled on the session's task, where the request-root
        anchor is whatever request opened the session, so prefer the transport the
        gateway published for this specific message. Without that, a failed tool
        call aimed its error at the ``initialize`` request's finished span and the
        SDK dropped it, leaving the POST that actually failed unmarked.N)rM   )r2   r3   r  r1   r   rc   )rv   rE  rS   r,  rM   rp   s         rb   Úasync_post_call_failure_hookz,OpenTelemetryV2.async_post_call_failure_hookú  sL   è ø€ ô& 1Ó2ÒoÔ6GÓ6IÒoÐM^×MoÑMoˆØˆ<Ô1°$Ô7ØÜ�DÔ4Ð5GÐWdÔeÔfØùs   ‚AAc           	      óæ   — t        j                  |«      }| j                  j                  t        j
                  |t        «       t        |j                  «      t        |j                  «      ¬«       y )Nr)  )
r%   Úfrom_logging_entryr“   rþ   r.   Ú	GUARDRAILr6   r0   rÒ   rÓ   )rv   Úentryr  s      rb   Úemit_guardrail_spanz#OpenTelemetryV2.emit_guardrail_span  sU   € ô (×:Ñ:¸5ÓAˆØ�‰×ÑÜ×ÑØÜ7Ó9Ü §¡Ó0Ü˜dŸm™mÓ,ð 	õ 	
rd   Úheadersc                 óH   — t        «       }t        |«      sy t        |«       |S rt   )r   r1   r8   )rv   rÒ   rM  rp   s       rb   Ú)create_litellm_proxy_request_started_spanz9OpenTelemetryV2.create_litellm_proxy_request_started_span)  s$   € ô 'Ó(ˆÜ! $Ô'ØÜ˜dÔ#Øˆrd   )NNNNN)r…   r†   rP   zGenAIMetricRecorder | None)rP   N)r×   z%Callable[[GenAIMetricRecorder], None]rP   N)r  r  rP   N)NNNN)Ú NNNNrt   ©rK  rH   rP   N)5rx   ry   rz   r{   r    r`   r   r   r   rw   rŽ   r’   Úlistr©   r–   rÊ   rÔ   rÏ   rÞ   rÚ   rå   r"   r   rò   r   rù   r	   ÚfloatÚboolrÌ   rÍ   r   rÎ   rn   r½   rü   r!   r
  Údictr"  r$  r!  r4  r   r;  r?  r}   rD  r¯   rG  rL  rO  Ú__classcell__)r—   s   @rb   r€   r€   ¥   s¬  ø„ Ù1ð 04Ø$(Ø15Ø15Ø15ñ2à%¨Ñ,ð2ð ˜T‘zð2ð (¨$Ñ.ð	2ð
 (¨$Ñ.ð2ð /ð2ð ð2ð 
õ2ó8TðS¨N¸TÑ,Að SÐFaó Sð(#°Dð #¸Tó #óAò(<
ò|Iókó	eóVò&CðM¨ð MÀsÈTÁzð MÐ\cð MÐhoó Mð,à˜˜V˜Ñ$ð,ð ˜uÑ$ tÑ+ð,ð ˜UÑ" TÑ)ð	,ð
 
ó,ð\'à˜˜V˜Ñ$ð'ð ˜uÑ$ tÑ+ð'ð ˜UÑ" TÑ)ð	'ð
 
ó'ðR+à˜˜V˜Ñ$ð+ð ˜uÑ$ tÑ+ð+ð ˜UÑ" TÑ)ð	+ð
 
�‰ó+ð>+¨ð +°lð +Àtó +ó;ð
59à&ð59ð ð59ð ˜uÑ$ tÑ+ð	59ð
 ˜UÑ" TÑ)ð59ð 
�‰ó59ð| )-Ø.2Ø,0Ø&*ñ
à'ð
ð  ™+ð
ð ˜uÑ$ tÑ+ð	
ð
 ˜UÑ" TÑ)ð
ð ˜t™ð
ð 
ó
ð( Ø(,Ø.2Ø,0Ø&*ñ
à'ð
ð �T‰zð
ð  ™+ð	
ð
 ˜uÑ$ tÑ+ð
ð ˜UÑ" TÑ)ð
ð ˜t™ð
ð 
ó
ð$-
à'ð-
ð  ™+ð	-
ð
 ˜uÑ$ tÑ+ð-
ð ˜UÑ" TÑ)ð-
ð ˜t™ð-
ð ˜d™
ð-
ð 
�‰ó-
ñh)°vð )ÀcÈDÁjð )Ð\`ó )ðV ð Sð Ð-=ò ó ððà+ðð ðð ð	ð
 &ðð 
óð
àð
ð &ð
ð ð	
ð
 
ó
ðB '+ñàðð &ðð ,ð	ð
 $ðð 
óó2
ð,Ø"ðØ-4°S¸#°XÑ->ÀÑ-Eðà	�‰÷rd   r€   Úin_memory_loggersÚ
registeredúOpenTelemetryV2 | Nonec                 óL   — |�|S t        d„ | D «       d«      }|�|S t        «       S )u~  The single ``OpenTelemetryV2`` whose provider should become the OTel global.

    The callback factory designates one logger as canonical the moment it builds
    the first one (``_init_otel_logger_on_litellm_proxy`` sets
    ``proxy_server.open_telemetry_logger``), and every other v2 entry point â€”
    guardrail, identity seeding, phase spans â€” already routes through that same
    ``registered`` owner. Reuse it here too so the global provider has one source
    of truth instead of a second, independently-derived guess; this is the logger
    a preset (arize, langfuse, â€¦) folds the ``OTEL_*`` base exporter and its own
    exporter into, so the FastAPI server span and the gen-ai spans share one
    provider and one trace.

    Fall back to ``in_memory_loggers`` for the SDK path, where no proxy global is
    set (selecting from there, not ``service_callback``, which a preset logger does
    not always reach), and build a generic logger from ``OTEL_*`` only when none was
    configured at all. Each fallback still avoids the second generic logger that
    orphaned the gen-ai spans onto a different backend than the server span.
    Nc              3   óB   K  — | ]  }t        |t        «      sŒ|–— Œ y ­wrt   )Ú
isinstancer€   r¢   s     rb   r¥   z/select_global_otel_v2_logger.<locals>.<genexpr>K  s   è ø€ Ò^ 2¼jÈÌ_Õ>]œBÑ^ùs   ‚˜)Únextr€   )rW  rX  Úexistings      rb   Úselect_global_otel_v2_loggerr_  3  s7   € ð, ÐØÐÜÑ^Ð):Ô^Ð`dÓe€HØÐ+ˆ8ÐB´Ó1BÐBrd   Úset_global_providerc                 óD   — t        | |¬«      } ||j                  «       |S )aÔ  Select the single v2 logger and publish its provider as the OTel global.

    The proxy calls this once at startup, after callbacks are initialized, so the
    preset logger already exists; it passes ``registered`` (the canonical owner the
    factory designated as ``proxy_server.open_telemetry_logger``) so the global
    provider reuses the same logger the rest of the v2 code emits through (see
    :func:`select_global_otel_v2_logger`). Both ``registered`` and
    ``set_global_provider`` (the proxy passes
    ``opentelemetry.trace.set_tracer_provider``) are injected so the publish step is
    unit-testable without reading or mutating real global OTel state. Returns the
    logger whose provider was published.
    )rX  )r_  rŒ   )rW  r`  rX  Úloggers       rb   Úpublish_global_otel_v2_providerrc  O  s$   € ô" 1Ð1BÈzÔZ€FÙ˜×/Ñ/Ô0Ø€Mrd   c                  óp   — 	 ddl m}  t        | dd «      }t	        |t
        «      r|S d S # t        $ r Y y w xY wr«   )r®   r¬   r¯   r´   r\  r€   )r¬   rb  s     rb   Ú_registered_v2_loggerre  e  sC   € ðÝ.ô ˜LÐ*AÀ4ÓH€FÜ ¬Ô8ˆ6ÐB¸dÐBøô ò Ùðús   ‚) ©	5´5c                 ó`   — t        «       }|€y	 |j                  | «       y# t        $ r Y yw xY w)uL  Emit a guardrail span on the registered v2 OTel logger.

    Called by the guardrail-recording code the moment a guardrail finishes, so a
    span is produced regardless of whether a post-call hook later runs (it does
    not on the pass-through allow path). Routes through the single canonical
    logger â€” the same one every other v2 entry point uses â€” so a guardrail
    recorded once yields exactly one span; fanning out across every reachable
    ``OpenTelemetryV2`` instance double-emits the same entry. Best-effort: span
    emission must never break guardrail evaluation.
    N)re  rL  r¯   )rK  rb  s     rb   rL  rL  n  s9   € ô *Ó+€FØ€~ØðØ×"Ñ" 5Õ)øÜò Ùðús   �! ¡	-¬-r,  rÆ   c                 óD   — t        «       }|�|j                  | |¬«       y y r>  )re  r4  )r,  rÆ   rb  s      rb   r4  r4  ‚  s)   € Ü)Ó+€FØÐØ×$Ñ$Ð%6¸eÐ$ÕDð rd   r5  zIterator[Span | None]c              #   ó‚   K  — t        «       }|€d –— y |j                  | «      5 }|–— d d d «       y # 1 sw Y   y xY w­wrt   )re  r;  )r5  rb  rp   s      rb   Ú
phase_spanri  ˆ  sD   è ø€ ä)Ó+€FØ€~ØŠ
ØØ	×	 Ñ	  Ó	&ð ¨$ØŠ
÷÷ ñ üs   ‚#?¥3ª	?³<¸?rt   )rP   rY  rQ  )xr{   Úcollectionsr   Úcollections.abcr   r   r   r   Ú
contextlibr   r	   Útypingr
   r   r   r   Úopentelemetry.contextr   r   r   Úopentelemetry.sdk._logsr   Úopentelemetry.sdk.tracer   Úopentelemetry.tracer   r   r   r   r   r   r   rJ   Úlitellm._loggingr   Ú"litellm.integrations.custom_loggerr   Ú!litellm.integrations.otel.emitterr   r   Ú!litellm.integrations.otel.mappersr   Ú'litellm.integrations.otel.model.baggager   Ú&litellm.integrations.otel.model.configr    Ú(litellm.integrations.otel.model.metadatar!   r"   r#   r$   Ú(litellm.integrations.otel.model.payloadsr%   r&   r'   r(   r)   r*   r+   r,   Ú'litellm.integrations.otel.model.semconvr-   Ú%litellm.integrations.otel.model.spansr.   r/   Ú%litellm.integrations.otel.model.utilsr0   Ú*litellm.integrations.otel.plumbing.contextr1   r2   r3   r4   r5   r6   r7   r8   Ú)litellm.integrations.otel.plumbing.eventsr9   Ú*litellm.integrations.otel.plumbing.metricsr:   r;   Ú,litellm.integrations.otel.plumbing.providersr<   r=   r>   r?   r@   rA   Ú*litellm.integrations.otel.plumbing.routingrB   Úopentelemetry.metricsrC   Úlitellm.caching.dual_cacherD   Úlitellm.proxy._typesrE   Úlitellm.types.servicesrF   Úlitellm.types.utilsrG   rH   rI   rK   Ú__annotations__r}   r`   rc   re   rf   rí   rl   rn   r€   rù   r_  rc  re  rL  r4  ri  r~   rd   rb   ú<module>rˆ     s  ðÚ @å #ß AÓ AÝ %Ý ß 2Ó 2ç >Ñ >Ý 2Ý 2÷÷ ñ ó Ý +Ý ;ß FÝ =Ý DÝ H÷ó ÷	÷ 	ó 	õ :ß QÝ 7÷	÷ 	ó 	õ I÷÷÷ õ IáÝ3å4Ý3Ý;÷ñ ð 'Ð �UÓ &ð #Ø $ò	Ø!ðð �t‘ðð ˜‘:ð	ð
 óð8€ˆuó ð  €�Ó ð8 '¨D¡.ð 8°U¸4À¸9Ñ5EÈÑ5Ló 8÷!ñ !ô:K
�lô K
ð` ,0ñCØ Ñ'ðCà(ðCð óCð> ,0ñØ Ñ'ðà! >Ð"2°DÐ"8Ñ9ðð )ðð ó	ó,Cóñ(E¨Vð E¸CÀ$¹Jð EÐRVó Eð ð�Sð Ð4ò ó ñrd   