관리-도구
편집 파일: aws_lambda.cpython-38.pyc
U �Mg�E � @ s� d dl Z d dlZd dlZd dlZd dlmZ d dlmZmZmZ d dl m Z d dlZd dlm Z d dlmZ d dlmZ d dlmZ d d lmZmZmZmZmZmZmZ d d lmZ d dlmZ d dl m!Z! e!�r*d d l m"Z" d dl m#Z# d dl m$Z$ d dl m%Z% d dl&m'Z'm(Z(m)Z) e#de$de"f d�Z*dZ+dZ,dd� Z-dd� Z.dd� Z/G dd� de�Z0dd � Z1d!d"� Z2d#d$� Z3d%d&� Z4d'd(� Z5d)d*� Z6dS )+� N)�deepcopy)�datetime� timedelta�timezone)�environ)�continue_trace)�OP)�should_send_default_pii)�TRANSACTION_SOURCE_COMPONENT)�AnnotatedValue�capture_internal_exceptions�ensure_integration_enabled�event_from_exception�logger� TimeoutThread�reraise)�Integration)�_filter_headers)� TYPE_CHECKING)�Any)�TypeVar)�Callable)�Optional)�EventProcessor�Event�Hint�F.)�boundi� g @�@c s t t� �� fdd��}|S )Nc s� t �� }t� �l t �� �� t�� }|rZt|�rZt||j ddd�d�\}}t j ||d� ntt� | d ��}t � |� W 5 Q R X � | |�S )N� aws_lambdaF��typeZhandled�Zclient_options� mechanism��hint� )� sentry_sdk� get_clientr Zget_isolation_scope�clear_breadcrumbs�sys�exc_info�allr �options� capture_event�_event_from_error_json�json�loads)�args�kwargs�clientr* �sentry_eventr$ �� init_error� �P/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/aws_lambda.py�sentry_init_error- s � z+_wrap_init_error.<locals>.sentry_init_error)r �AwsLambdaIntegration)r6 r9 r7 r5 r8 �_wrap_init_error+ s r; c s t �� �� fdd��}|S )Nc s t �� }|�t�}|d kr,� | |f|�|�S t| t�rTt| �dkrT| d }t| �}n| }d}t|t�sji }|�� }t � � ���} d } t � �� | �� | �t |||�� | �d|j�d�d � |dkr�| �dd� | �d|� |j�r|tk�r|t t }t||t �} | �� W 5 Q R X |�d i �}t|t��s6i }t|tj|jttjd �} t j| | |d�d��� z�z0� | |f|�|�W W �lW 5 Q R � W 5 Q R � S tk �r� t �!� }t"||j#d dd�d�\}}t j$||d� t%|� Y nX W 5 | �r�| �� X W 5 Q R X W 5 Q R X d S )Nr% r Z aws_region�:� Z batch_requestT� batch_size�headers)�op�name�source�origin)� aws_event�aws_context)Zcustom_sampling_contextr Fr r! r# )&r&