
    tni                         d dl 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 	 d dlmZmZmZmZmZmZ d dlmZ n# e$ r  e	d          w xY w G d	 d
          Z G d dee          Z G d dee          ZdS )    )CallableUnionAsyncIterableAnyN)OP)DidNotEnable)SPAN_ORIGIN)UnaryUnaryClientInterceptorUnaryStreamClientInterceptorClientCallDetailsUnaryUnaryCallUnaryStreamCallMetadata)Messagezgrpcio is not installedc                   .    e Zd Ze	 	 	 	 dd            ZdS )ClientInterceptorclient_call_detailsr   returnc                 t   | j         #|                     t                                } nGt          | j         t                    s-|                     t          j        | j                             } t          j                                                    D ] \  }}| j                             ||           !| S )N)metadata)	r   _replacer   
isinstance
from_tuple
sentry_sdkget_current_scopeiter_trace_propagation_headersadd)r   keyvalues      d/var/www/html/gpu-tools/venv/lib/python3.11/site-packages/sentry_sdk/integrations/grpc/aio/client.py/_update_client_call_details_metadata_from_scopezAClientInterceptor._update_client_call_details_metadata_from_scope   s     '/"5">">

">"S"S/8(CC 	 #6">">!,-@-IJJ #? # # )++JJLL	9 	9 
(,,S%8888""    N)r   r   r   r   )__name__
__module____qualname__staticmethodr!    r"   r    r   r      sB        #0#	# # # \# # #r"   r   c                   &    e Zd Z	 	 	 	 	 	 	 	 dd	Zd
S )!SentryUnaryUnaryClientInterceptorcontinuation6Callable[[ClientCallDetails, Message], UnaryUnaryCall]r   r   requestr   r   Union[UnaryUnaryCall, Message]c                   K   |j         }t          j        t          j        d|                                z  t                    5 }|                    dd           |                    d|           |                     |          } |||           d {V }|	                                 d {V }|                    d|j
                   |cd d d            S # 1 swxY w Y   d S )Nzunary unary call to %sopnameorigintypezunary unarymethodcode)r4   r   
start_spanr   GRPC_CLIENTdecoder	   set_datar!   r5   r1   )selfr*   r   r,   r4   spanresponsestatus_codes           r    intercept_unary_unaryz7SentryUnaryUnaryClientInterceptor.intercept_unary_unary,   sD      %+"~)FMMOO;
 
 
 	 MM&-000MM(F+++"&"V"V## # *\*=wGGGGGGGGH (//////KMM&+"2333!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   B
CC #C N)r*   r+   r   r   r,   r   r   r-   )r#   r$   r%   r>   r'   r"   r    r)   r)   +   sN        N 1 	
 
*     r"   r)   c                   &    e Zd Z	 	 	 	 	 	 	 	 dd	Zd
S )"SentryUnaryStreamClientInterceptorr*   7Callable[[ClientCallDetails, Message], UnaryStreamCall]r   r   r,   r   r   *Union[AsyncIterable[Any], UnaryStreamCall]c                 h  K   |j         }t          j        t          j        d|                                z  t                    5 }|                    dd           |                    d|           |                     |          } |||           d {V }|cd d d            S # 1 swxY w Y   d S )Nzunary stream call to %sr/   r3   zunary streamr4   )	r4   r   r6   r   r7   r8   r	   r9   r!   )r:   r*   r   r,   r4   r;   r<   s          r    intercept_unary_streamz9SentryUnaryStreamClientInterceptor.intercept_unary_streamK   s      %+"~*V]]__<
 
 
 	 MM&.111MM(F+++"&"V"V## # *\*=wGGGGGGGGH !	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AB''B+.B+N)r*   rA   r   r   r,   r   r   rB   )r#   r$   r%   rD   r'   r"   r    r@   r@   G   sN        O 1 	
 
6     r"   r@   )typingr   r   r   r   r   sentry_sdk.constsr   sentry_sdk.integrationsr   #sentry_sdk.integrations.grpc.constsr	   grpc.aior
   r   r   r   r   r   google.protobuf.messager   ImportErrorr   r)   r@   r'   r"   r    <module>rL      s   6 6 6 6 6 6 6 6 6 6 6 6                 0 0 0 0 0 0 ; ; ; ; ; ;2                0////// 2 2 2
,0
1
112# # # # # # # #*    (9;V   8         s	   ; A