관리-도구
편집 파일: gcp.cpython-37.pyc
B T a^ � @ s d dl m Z mZ d dlmZ d dlZd dlmZmZ d dlm Z d dl mZ d dlm Z mZmZmZmZ d dlmZ d d lmZ d d lmZ dZdZer�d d lmZ d dlmZ d dlmZ d dlmZ d dlmZm Z m!Z! ededef d�Z"dd� Z#G dd� de�Z$dd� Z%dd� Z&dS )� )�datetime� timedelta)�environN)�Hub�_should_send_default_pii)�Transaction)�reraise)�AnnotatedValue�capture_internal_exceptions�event_from_exception�logger� TimeoutThread)�Integration)�_filter_headers)�MYPYg �?g @�@)�Any)�TypeVar)�Callable)�Optional)�EventProcessor�Event�Hint�F.)�boundc s � fdd�}|S )Nc s� t j}|�t�}|d kr*� | |f|�|�S |j}t�d�}|sZt�d� � | |f|�|�S t |�}t �� }|�� ��j} t � �^ | �� | �t|||�� | �dt�d�� d } |jr�|tkr�|t }t||�} | �� W d Q R X i }t|d�r�|j}tj|dt�dd�d �} t�d�t�d �t�d�t�d�t�d�d �|d�}|j| |d��� zfy� | |f|�|�S tk �r� t�� }t||jddd�d�\}}|j ||d� t!|� Y nX W d | �r�| �"� |�#� X W d Q R X W d Q R X d S )NZFUNCTION_TIMEOUT_SECzOThe configured timeout could not be fetched from Cloud Functions configuration.Z gcp_region�FUNCTION_REGION�headerszserverless.function� FUNCTION_NAME� )�op�name�ENTRY_POINT�FUNCTION_IDENTITY�GCP_PROJECT)� function_name�function_entry_point�function_identity�function_region�function_project)Zgcp_env� gcp_event)Zcustom_sampling_context�gcpF)�typeZhandled)Zclient_optionsZ mechanism)�hint)$r �currentZget_integration�GcpIntegration�clientr �getr �debug�intr �utcnowZ push_scoper Zclear_breadcrumbsZadd_event_processor�_make_request_event_processorZset_tag�timeout_warning�TIMEOUT_WARNING_BUFFERr �start�hasattrr r Zcontinue_from_headersZstart_transaction� Exception�sys�exc_infor �optionsZ capture_eventr �stop�flush)Zfunctionhandlerr( �args�kwargsZhubZintegrationr. Zconfigured_time�initial_timeZscopeZtimeout_threadZwaiting_timer ZtransactionZsampling_contextr: Zsentry_eventr+ )�func� �L/opt/alt/python37/lib/python3.7/site-packages/sentry_sdk/integrations/gcp.py�sentry_func% sf z_wrap_func.<locals>.sentry_funcrB )rA rD rB )rA rC � _wrap_func# s OrE c @ s&