U 췀g @sddlZddlmZddlmZddlmZddlmZm Z ddl m Z e rhddl m Z m Z ddlmZz ddlZdd lmZmZmZWnek red YnXGd d d ejZdS) N)OP) DidNotEnable) SPAN_ORIGIN) TransactionTRANSACTION_SOURCE_CUSTOM) TYPE_CHECKING)CallableOptional)Message)ServicerContextHandlerCallDetailsRpcMethodHandlerzgrpcio is not installedcs2eZdZdfdd ZddZeddZZS) ServerInterceptorNcs|ptj|_tdSN)r _find_name_find_method_namesuper__init__)selfZ find_name __class__Q/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/grpc/server.pyrs zServerInterceptor.__init__cs8||rjsSfdd}tj|jjdS)Nc st|}|rt|}tj|tj|t t d}tj |dTz& ||WW5QRW5QRSt k r}z|W5d}~XYnXW5QRXn ||W5QRSW5QRXdS)N)opnamesourceorigin) transaction) sentry_sdkZisolation_scoperdictZinvocation_metadatarZcontinue_from_headersrZ GRPC_SERVERrrZstart_transaction unary_unary BaseException)requestcontextrmetadatarehandlerrrrbehavior!s"   &"z5ServerInterceptor.intercept_service..behavior)request_deserializerresponse_serializer)r grpcZunary_unary_rpc_method_handlerr)r*)rZ continuationZhandler_call_detailsr(rr&rintercept_services z#ServerInterceptor.intercept_servicecCs|jjjSr)Z _rpc_eventZ call_detailsmethoddecode)r#rrrr?szServerInterceptor._find_name)N)__name__ __module__ __qualname__rr, staticmethodr __classcell__rrrrrs$r)rZsentry_sdk.constsrZsentry_sdk.integrationsrZ#sentry_sdk.integrations.grpc.constsrZsentry_sdk.tracingrrtypingrrr Zgoogle.protobuf.messager r+r r r ImportErrorrrrrrs