o
    1 i                     @   sx   d dl mZ d dlmZ G dd dZzd dlmZmZmZm	Z	 G dd dZ
W d	S  ey;   G dd deZ
Y d	S w )
    )Optional)COMPONENT_METRICS_TAG_KEYSc                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	
NullMetriczGMock metric class to be used in case of prometheus_client import error.c                 O      d S N selfargskwargsr   r   k/home/app/PaddleOCR-VL-test/.venv_paddleocr/lib/python3.10/site-packages/ray/dashboard/dashboard_metrics.pyset	      zNullMetric.setc                 O   r   r   r   r   r   r   r   observe   r   zNullMetric.observec                 O   r   r   r   r   r   r   r   inc   r   zNullMetric.incN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r      s
    r   )CollectorRegistryCounterGauge	Histogramc                   @   s    e Zd Zddee fddZdS )DashboardPrometheusMetricsNregistryc              	   C   s   |pt dd| _g d}tddddd| j|d	| _td
dddd| jd| _tddttdd| jd| _	tddttdd| jd| _
tddttdd| jd| _tddttdd| jd| _tddttdd| jd| _d S )NT)Zauto_describe)g{Gzt?g{Gz?g?g?g333333?g?g      ?g      ?g      ?   g      @   g      @
      (   <   Z'dashboard_api_requests_duration_secondsz&Total duration in seconds per endpoint)endpointhttp_statusVersionSessionName	ComponentsecondsZray)unit	namespacer   ZbucketsZdashboard_api_requests_countz!Total requests count per endpoint)methodr!   r"   r#   r$   r%   requests)r'   r(   r   Zdashboard_event_loop_tasksz<Number of tasks currently pending in the event loop's queue.tasksZdashboard_event_loop_lagzEvent loop lag in seconds.Zcomponent_cpuzDashboard CPU percentage usage.
percentageZcomponent_ussz(USS usage of all components on the node.mbZcomponent_rssz(RSS usage of all components on the node.)r   r   r   Zmetrics_request_durationr   Zmetrics_request_countr   tupler   Zmetrics_event_loop_tasksZmetrics_event_loop_lagZmetrics_dashboard_cpuZmetrics_dashboard_mem_ussZmetrics_dashboard_mem_rss)r	   r   Zhistogram_buckets_sr   r   r   __init__   sz   	z#DashboardPrometheusMetrics.__init__r   )r   r   r   r   r   r/   r   r   r   r   r      s    r   c                   @   s   e Zd Zdd ZdS )r   c                 C   s   t  S r   )r   )r	   attrr   r   r   __getattr__z   s   z&DashboardPrometheusMetrics.__getattr__N)r   r   r   r1   r   r   r   r   r   y   s    N)typingr   Zray.dashboard.constsr   r   Zprometheus_clientr   r   r   r   r   ImportErrorobjectr   r   r   r   <module>   s    ^