관리-도구
편집 파일: spotlight.cpython-38.pyc
U �Mg9 � @ s d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ d dl m Z e r|d dl mZ d dl mZ d dl m Z d dl mZ d dlmZmZmZ d d lmZ d ZdZG dd � d �Zz*d dlmZ d dlmZ G dd� d�ZW n ek r� dZY nX dd� ZdS )� N)�chain)� TYPE_CHECKING)�Any)�Callable)�Dict)�Optional)�logger�env_to_bool�capture_internal_exceptions)�Envelopezhttp://localhost:8969/streamz(sentry_sdk.spotlight.SpotlightMiddlewarec @ s e Zd Zdd� Zdd� ZdS )�SpotlightClientc C s || _ t�� | _d| _d S )Nr )�url�urllib3�PoolManager�http�tries)�selfr � r �B/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/spotlight.py�__init__ s zSpotlightClient.__init__c C s� | j dkrt�d� d S t�� }|�|� z*| jj| j|� � dddid�}|� � W n> tk r� } z | j d7 _ t�t|�� W 5 d }~X Y nX d S )N� z@Too many errors sending to Spotlight, stop sending events there.�POSTzContent-Typezapplication/x-sentry-envelope)r �body�method�headers� ) r r �warning�io�BytesIOZserialize_intor �requestr �getvalue�close� Exception�str)r �enveloper �req�er r r �capture_envelope! s( � ��z SpotlightClient.capture_envelopeN)�__name__� __module__�__qualname__r r'