관리-도구
편집 파일: clickhouse_driver.cpython-38.pyc
U �Mgx � @ sn d dl Z d dlmZmZ d dlmZmZ d dlmZ d dl m Z d dlmZm Z d dlmZmZ ervd dlmZmZ n"G d d � d �ZG dd� d�Ze� Zzd dlZW n ek r� ed ��Y nX ejdk r�ed��G dd� de�Zed�Zed�Zeeef eeef d�dd�Zeeef eeef d�dd�Zeeef eeef d�dd�Zeejjdd�dd�ZdS )� N)�OP�SPANDATA)�Integration�DidNotEnable)�Span)�should_send_default_pii)�capture_internal_exceptions�ensure_integration_enabled)� TYPE_CHECKING�TypeVar)� ParamSpec�Callablec @ s e Zd Zdd� ZdS )r c C s d | _ d | _d S �N)�args�kwargs��self�_� r �W/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/clickhouse_driver.py�__init__ s zParamSpec.__init__N)�__name__� __module__�__qualname__r r r r r r s r c @ s e Zd Zdd� ZdS )� _Callablec C s d S r r r r r r �__getitem__ s z_Callable.__getitem__N)r r r r r r r r r s r z clickhouse-driver not installed.)r � r z#clickhouse-driver >= 0.2.0 requiredc @ s, e Zd ZdZde� �Zedd�dd��ZdS )�ClickhouseDriverIntegration�clickhouse_driverzauto.db.N)�returnc C sv t tjjj�tjj_ttjjj�tjj_t tjjj �tjj_ ttjjd�r^t tjjj�tjj_t tjjj �tjj_ d S )N�receive_end_of_insert_query)�_wrap_startr � connection� ConnectionZ send_query�_wrap_send_data�clientZClientZ send_data� _wrap_endZreceive_end_of_query�hasattrr Zreceive_resultr r r r � setup_once- s � � � � �z&ClickhouseDriverIntegration.setup_once)r r r � identifier�origin�staticmethodr( r r r r r ) s r �P�T)�fr c s( t t� �tjtjtd�� fdd��}|S )N�r r r c s� | d }| d }t | �dkr$| d n|�d�}t | �dkrB| d n|�d�}tjtj|tjd�}||_t ||� |� d|� |r�|� d |� |r�t� r�|� d |� � | |�}|S )Nr � r �query_id� �params)�op�namer* �queryzdb.query_id� db.params)�len�get� sentry_sdkZ start_spanr ZDBr r* �_sentry_span�_set_db_data�set_datar )r r r"