U 췀g @sddlmZmZmZmZddlmZmZmZm Z m Z m Z ddl m Z ddlZddlmZddlmZGdddZGd d d eeZGd d d eeZdS) )CallableUnion AsyncIterableAny)UnaryUnaryClientInterceptorUnaryStreamClientInterceptorClientCallDetailsUnaryUnaryCallUnaryStreamCallMetadata)MessageN)OP) SPAN_ORIGINc@s eZdZeeedddZdS)ClientInterceptor)client_call_detailsreturncCsb|jdkr|jtd}n t|jts:|jt|jd}tD]\}}|j||qF|S)N)metadata) r_replacer isinstanceZ from_tuple sentry_sdkZget_current_scopeZiter_trace_propagation_headersadd)rkeyvaluerU/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/grpc/aio/client.py/_update_client_call_details_metadata_from_scopes    zAClientInterceptor._update_client_call_details_metadata_from_scopeN)__name__ __module__ __qualname__ staticmethodrrrrrrrsrc@s4eZdZeeegefeeeeefdddZdS)!SentryUnaryUnaryClientInterceptor continuationrrequestrc s|j}tjtjd|td`}|dd|d|||}|||IdH}| IdH}|d|j |W5QRSQRXdS)Nzunary unary call to %sopnameorigintypez unary unarymethodcode) r)r start_spanr GRPC_CLIENTdecoderset_datarr*r&)selfr"rr#r)spanresponse status_coderrrintercept_unary_unary(s    z7SentryUnaryUnaryClientInterceptor.intercept_unary_unaryN) rrrrrr r rr3rrrrr 's  r c@s8eZdZeeegefeeeee efdddZ dS)"SentryUnaryStreamClientInterceptorr!c sn|j}tjtjd|tdD}|dd|d|||}|||IdH}|W5QRSQRXdS)Nzunary stream call to %sr$r(z unary streamr)) r)rr+r r,r-rr.r)r/r"rr#r)r0r1rrrintercept_unary_streamFs   z9SentryUnaryStreamClientInterceptor.intercept_unary_streamN) rrrrrr r rrrr5rrrrr4Cs r4)typingrrrrZgrpc.aiorrrr r r Zgoogle.protobuf.messager rZsentry_sdk.constsr Z#sentry_sdk.integrations.grpc.constsrrr r4rrrrs