관리-도구
편집 파일: fastapi.cpython-38.pyc
U �Mg� � @ s d dl Z d dlmZ d dlmZ d dlZd dlmZ d dlm Z d dl mZmZ d dl mZmZ d dlmZ er�d d lmZmZmZ d d lmZ zd dlmZmZ W n ek r� ed��Y nX zd dlZW n ek r� ed ��Y nX dZG dd� de�Zdd� Zdd� ZdS )� N)�deepcopy)�wraps)�DidNotEnable)�should_send_default_pii)�SOURCE_FOR_STYLE�TRANSACTION_SOURCE_ROUTE)�transaction_from_function�logger)� TYPE_CHECKING)�Any�Callable�Dict)�Event)�StarletteIntegration�StarletteRequestExtractorzStarlette is not installedzFastAPI is not installedzgeneric FastAPI requestc @ s e Zd ZdZedd� �ZdS )�FastApiIntegration�fastapic C s t � d S �N)�patch_get_request_handler� r r �M/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/fastapi.py� setup_once( s zFastApiIntegration.setup_onceN)�__name__� __module__�__qualname__� identifier�staticmethodr r r r r r % s r c C s� d}|dkr*|j �d�}|rZt|�p&d}n0|dkrZ|j �d�}|rZt|dd �}|d k rZ|}|sht}t}nt| }| j||d� t� d||� d S )N� �endpoint�url�route�path)�sourcez;[FastAPI] Set transaction name and source on scope: %s / %s) �scope�getr �getattr�_DEFAULT_TRANSACTION_NAMEr r Zset_transaction_namer �debug)r# �transaction_style�request�namer r r! r"