+
    Q(iY                         R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
HtHtHt ^ RIHtHt R R ltR	 R
 ltR R lt]RR R ll4       t]R R l4       t. ROtR# )zServer-side telemetry helpers.)	Generator)contextmanager)request_ctxContext)SpanSpanKindStatus
StatusCode)extract_trace_context
get_tracerc                F    V ^8  d   QhR\         \        \        3,          /#    returndictstr)formats   "^/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/fastmcp/server/telemetry.py__annotate__r      s      $sCx.     c                     ^ RI Hp  / p V ! 4       pV'       dR   VP                  '       d   VP                  VR&   VP                  '       d   RP	                  VP                  4      VR&   V#   \
         d     T# i ; i)z>Get auth attributes for the current request, if authenticated.)get_access_tokenz
enduser.id zenduser.scope)fastmcp.server.dependenciesr   	client_idscopesjoinRuntimeError)r   attrstokens      r   get_auth_span_attributesr"      sq    <E "&+ool#|||),%,,)?o& L  Ls!   A, A,  A, A, ,A;:A;c                F    V ^8  d   QhR\         \        \        3,          /# r   r   )r   s   "r   r   r      s      T#s(^ r   c                     ^ RI Hp  / p V ! 4       pVP                  e   VP                  e   VP                  VR&   V#   \         d     T# i ; i)z/Get session attributes for the current request.)get_contextzmcp.session.id)r   r%   request_context
session_idr   )r%   r    ctxs      r   get_session_span_attributesr)      sZ    7Em*s~~/I&)nnE"# L  Ls   2> AAc                2    V ^8  d   QhR\         R,          /# )r   r   Nr   )r   s   "r   r   r   ,   s      7T> r   c                      \         P                  ! 4       p V '       dC   \        V R4      '       d1   V P                  '       d   \	        \        V P                  4      4      # R#   \         d     R# i ; i)zCGet parent trace context from request meta for distributed tracing.metaN)r   gethasattrr,   r   r   LookupError)req_ctxs    r   _get_parent_trace_contextr1   ,   sZ    //#ww//GLLL(gll);<<   s   A# #A# A# #A21A2Nc                    V ^8  d   QhR\         R\         R\         R\         R\         R\         R,          R\        \        RR3,          /# )	r   namemethodserver_namecomponent_typecomponent_keyresource_uriNr   r   r   r   )r   s   "r   r   r   8   s^     ( (
(( ( 	(
 ( *( tT4 (r   c              #    "   \        4       pVP                  V \        4       \        P                  R7      ;_uu_ 4       pRRRVRVRVRVRVR	V/\        4       C\        4       CpVe   WXR&   VP                  V4        Vx   R
R
R
4       R
#   \         d@   p	TP                  T	4       TP                  \        \        P                  4      4       h R
p	?	ii ; i  + '       g   i     R
# ; i5i)zCreate a SERVER span with standard MCP attributes and auth context.

Automatically records any exception on the span and sets error status.
)contextkindz
rpc.systemmcpzrpc.servicez
rpc.methodzmcp.method.namezfastmcp.server.namezfastmcp.component.typefastmcp.component.keyNzmcp.resource.uri)r   start_as_current_spanr1   r   SERVERr"   r)   set_attributes	Exceptionrecord_exception
set_statusr	   r
   ERROR)
r3   r4   r5   r6   r7   r8   tracerspanr    es
   &&&&&&    r   server_spanrI   7   s      \F		%	%)+__ 
& 
 
 
 %;&v!;$n#]!
 '(!
 *+!
 #(4$%E"	J/
 
0  	!!!$OOF:#3#345	1
 
 
s:   =C.>C>B
C.C:CCCC+	%	C.c                d    V ^8  d   QhR\         R\         R\         R\        \        RR3,          /# )r   r3   provider_typer7   r   Nr9   )r   s   "r   r   r   d   s<      
  tT4 	r   c              #  d  "   \        4       pVP                  RV  24      ;_uu_ 4       pVP                  RVRV/4        Vx   RRR4       R#   \         d@   pTP	                  T4       TP                  \        \        P                  4      4       h Rp?ii ; i  + '       g   i     R# ; i5i)zCreate an INTERNAL span for provider delegation.

Used by FastMCPProvider when delegating to mounted servers.
Automatically records any exception on the span and sets error status.
z	delegate zfastmcp.provider.typer>   N)	r   r?   rA   rB   rC   rD   r	   r
   rE   )r3   rK   r7   rF   rG   rH   s   &&&   r   delegate_spanrM   c   s      \F		%	%	$&8	9	9T''	
	J 
:	9  	!!!$OOF:#3#345	 
:	9	9s:   'B0B A
B0B:BBBB-	'	B0)N)rM   r"   r)   rI   )__doc__collections.abcr   
contextlibr   mcp.server.lowlevel.serverr   opentelemetry.contextr   opentelemetry.tracer   r   r	   r
   fastmcp.telemetryr   r   r"   r)   r1   rI   rM   __all__ r   r   <module>rW      s\    $ % % 2 ) B B ?" ( (V  4r   