o
    h                     @   s   d dl mZmZmZmZ d dlmZmZmZm	Z	m
Z
mZ d dlmZ d dlZd dlmZ d dlmZ G dd dZG d	d
 d
eeZG dd deeZdS )    )CallableUnionAsyncIterableAny)UnaryUnaryClientInterceptorUnaryStreamClientInterceptorClientCallDetailsUnaryUnaryCallUnaryStreamCallMetadata)MessageN)OP)SPAN_ORIGINc                   @   s"   e Zd ZededefddZdS )ClientInterceptorclient_call_detailsreturnc                 C   sb   | j d u r| jt d} nt| j ts| jt| j d} t  D ]\}}| j || q#| S )N)metadata)	r   _replacer   
isinstance
from_tuple
sentry_sdkget_current_scopeiter_trace_propagation_headersadd)r   keyvalue r   i/var/www/html/pro-man-master/venv/lib/python3.10/site-packages/sentry_sdk/integrations/grpc/aio/client.py/_update_client_call_details_metadata_from_scope   s   


zAClientInterceptor._update_client_call_details_metadata_from_scopeN)__name__
__module____qualname__staticmethodr   r   r   r   r   r   r      s    r   c                
   @   s:   e Zd Zdeeegef dededeeef fddZdS )!SentryUnaryUnaryClientInterceptorcontinuationr   requestr   c                    s   |j }tjtjd|  td1}|dd |d| | |}|||I d H }|	 I d H }|d|j
 |W  d    S 1 sEw   Y  d S )Nzunary unary call to %sopnameorigintypezunary unarymethodcode)r+   r   
start_spanr   GRPC_CLIENTdecoder   set_datar   r,   r(   )selfr$   r   r%   r+   spanresponsestatus_coder   r   r   intercept_unary_unary(   s$   
$z7SentryUnaryUnaryClientInterceptor.intercept_unary_unaryN)	r   r    r!   r   r   r   r	   r   r5   r   r   r   r   r#   '   s    
r#   c                
   @   s>   e Zd Zdeeegef dededeee	 ef fddZ
dS )"SentryUnaryStreamClientInterceptorr$   r   r%   r   c                    s|   |j }tjtjd|  td#}|dd |d| | |}|||I d H }|W  d    S 1 s7w   Y  d S )Nzunary stream call to %sr&   r*   zunary streamr+   )	r+   r   r-   r   r.   r/   r   r0   r   )r1   r$   r   r%   r+   r2   r3   r   r   r   intercept_unary_streamF   s    
$z9SentryUnaryStreamClientInterceptor.intercept_unary_streamN)r   r    r!   r   r   r   r
   r   r   r   r7   r   r   r   r   r6   C   s    r6   )typingr   r   r   r   grpc.aior   r   r   r	   r
   r   google.protobuf.messager   r   sentry_sdk.constsr   #sentry_sdk.integrations.grpc.constsr   r   r#   r6   r   r   r   r   <module>   s     
