관리-도구
편집 파일: rq.cpython-37.pyc
B T aZ � @ s d dl mZ d dlZd dlmZ d dlmZmZ d dlm Z d dl mZ d dlm Z mZ y4d dlmZ d d lmZ d d lmZ d dlmZ W n ek r� ed��Y nX d d lmZ er�d dlmZmZmZ d dlmZ d dlm Z d dl!m"Z" G dd� de�Z#dd� Z$dd� Z%dS )� )�absolute_importN)�Hub)�DidNotEnable�Integration)� ignore_logger)�Transaction)�capture_internal_exceptions�event_from_exception)�Queue)�JobTimeoutException)�VERSION)�WorkerzRQ not installed)�MYPY)�Any�Callable�Dict)�EventProcessor)�ExcInfo)�Jobc @ s e Zd ZdZedd� �ZdS )� RqIntegration�rqc s� y t ttt�d�d d� ��} W n& ttfk rF td�t���Y nX | dk rXtd��t j ��fdd�}|t _ t j��fdd �}|t _tj � � fd d�}|t_ td� d S ) N�.� zUnparsable RQ version: {})r � zRQ 0.6 or newer is required.c s� t j}|�t�}|d kr*� | |f|�|�S |j}|d k s<t�|�� ��}|�� |�t t �|��� tj |j�d�pti ddd�}t� � |j|_W d Q R X |j|d|id�� � | |f|�|�} W d Q R X W d Q R X | jr�|�� | S )N�_sentry_trace_headerszrq.taskzunknown RQ task)�op�nameZrq_job)Zcustom_sampling_context)r �current�get_integrationr �client�AssertionErrorZ push_scopeZclear_breadcrumbsZadd_event_processor�_make_event_processor�weakref�refr Zcontinue_from_headers�meta�getr � func_namer Zstart_transactionZis_horse�flush) �self�job�args�kwargs�hubZintegrationr ZscopeZtransaction�rv)�old_perform_job� �K/opt/alt/python37/lib/python3.7/site-packages/sentry_sdk/integrations/rq.py�sentry_patched_perform_job/ s* &z<RqIntegration.setup_once.<locals>.sentry_patched_perform_jobc s |j rt|� � | |f|�|�S )N)Z is_failed�_capture_exception)r( r) �exc_infor+ )�old_handle_exceptionr/ r0 �sentry_patched_handle_exceptionX s zARqIntegration.setup_once.<locals>.sentry_patched_handle_exceptionc s4 t j}|�t�d k r&t|�� �|jd<