관리-도구
편집 파일: monitor.cpython-311.pyc
� �܋f� � �r � d dl Z d dlZd dlmZmZ d dlZd dlmZ d dlm Z e rd dl mZ G d� de� � Z dS )� N)�Thread�Lock)�logger)� TYPE_CHECKING)�Optionalc �^ � e Zd ZdZdZdd�Zd� Zd� Zd� Zd� Z d � Z ed � � � Zd� Z d� Zd S )�Monitorz� Performs health checks in a separate thread once every interval seconds and updates the internal state. Other parts of the SDK only read this state and act accordingly. zsentry.monitor� c � � || _ || _ d| _ d| _ d | _ t � � | _ d | _ d| _ d S )NT� ) � transport�interval�_healthy�_downsample_factor�_threadr �_thread_lock�_thread_for_pid�_running)�selfr r s �I/opt/cloudlinux/venv/lib64/python3.11/site-packages/sentry_sdk/monitor.py�__init__zMonitor.__init__ sE � �"��� �� ��� �"#������ �F�F���#����� � � � c � � � � j t j � � k r � j �d S � j 5 � j t j � � k r� j � d d d � � d S � fd�}t � j |�� � }d|_ |� � � |� _ t j � � � _ d d d � � n# 1 swxY w Y d S )Nc � �� � j r=t j � j � � � j r� � � � � j �;d S d S �N)r �time�sleepr �run�r s �r r z(Monitor._ensure_running.<locals>._thread, sV �� ��m� #��J�t�}�-�-�-��}� #���� � � � �m� #� #� #� #� #r )�name�targetT) r �os�getpidr r r r �daemon�start)r r �threads ` r �_ensure_runningzMonitor._ensure_running# s& �� ���2�9�;�;�.�.�4�<�3K��4� � � /� /��#�r�y�{�{�2�2�t�|�7O�� /� /� /� /� /� /� /� /� #� #� #� #� #� ���7�;�;�;�F� �F�M��L�L�N�N�N�!�D�L�#%�9�;�;�D� � /� /� /� /� /� /� /� /� /� /� /���� /� /� /� /�"