관리-도구
편집 파일: server.cpython-38.pyc
U �Mg� � @ s� d dl Z d dlmZ d dlmZ d dlmZ d dlmZm Z d dl mZ erhd dl mZm Z d dlmZ z d dlZd d lmZmZmZ W n ek r� ed ��Y nX G dd� dej�ZdS ) � N)�OP)�DidNotEnable)�SPAN_ORIGIN)�Transaction�TRANSACTION_SOURCE_CUSTOM)� TYPE_CHECKING)�Callable�Optional)�Message)�ServicerContext�HandlerCallDetails�RpcMethodHandlerzgrpcio is not installedc s2 e Zd Zd� fdd� Zdd� Zedd� �Z� ZS ) �ServerInterceptorNc s |pt j| _t� �� d S �N)r � _find_name�_find_method_name�super�__init__)�selfZ find_name�� __class__� �Q/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/grpc/server.pyr s zServerInterceptor.__init__c s8 ||�� � r� j s� S � �fdd�}tj|� j� jd�S )Nc s� t �� �� ��|�}|r�t|�� �}tj|tj|t t d�}t j|d��T z&� �| |�W W 5 Q R � W 5 Q R � S t k r� } z|�W 5 d }~X Y nX W 5 Q R X n� �| |�W 5 Q R � S W 5 Q R X d S )N)�op�name�source�origin)�transaction)� sentry_sdkZisolation_scoper �dictZinvocation_metadatar Zcontinue_from_headersr ZGRPC_SERVERr r Zstart_transaction�unary_unary� BaseException)�request�contextr �metadatar �e��handlerr r r �behavior! s"