
    i|                     t    d Z ddlZej                  d   Zeeeef      Zeej                     Z
 G d d      Zy)zBModule providing support for displaying data in OpenMetrics format    N)countergauge	histogramsummaryc                   L    e Zd ZdZdededededeej                     f
dZ
d Zy	)
OpenMetricsFamilya  A family of metrics.

    - The ``key`` parameter is the metric name that should be used (snake case).
    - The ``type_hint`` parameter must be one of ``counter``, ``gauge``,
      ``histogram``, ``summary``.
    - The ``help_hint`` parameter is a short string explaining the metric.
    - The data_info parameter is a dictionary of descriptionary parameters for
      the data point (e.g. request method/path).

    - The data parameter is a flat list of the actual data in shape of a
      primitive type.

    See `OpenMetrics specification`_ for more information.

    .. _OpenMetrics specification:
       https://github.com/prometheus/OpenMetrics/blob/main/specification/OpenMetrics.txt

    key	type_hint	help_hint	data_infodatac                 J    || _         || _        || _        || _        || _        y )N)r	   r
   r   r   r   )selfr	   r
   r   r   r   s         "/root/searxng/searx/openmetrics.py__init__zOpenMetricsFamily.__init__   s'     *3'*3!%	    c                    d| j                    d| j                   d| j                    d| j                   d	}t        | j                        D ]t  \  }}|r| j
                  |   sdj                  |j                         D cg c]  \  }}| d| d c}}      }|| j                    d| d	| j
                  |    dz  }v |S c c}}w )
Nz# HELP  z
# TYPE 
,z=""{z} )r	   r   r
   	enumerater   r   joinitems)r   text_representationidata_info_dictr	   valueinfo_representations          r   __str__zOpenMetricsFamily.__str__(   s    #z4>>" #z4>>" #
 "+4>>!: 	[A~!1"%((SaSgSgSi+j<Cse2eWA,>+j"kdhhZr2E1Fc$))TU,WY#ZZ	[ #" ,ks   CN)__name__
__module____qualname____doc__strOMFTypeHintTypeOMFDataInfoTypelisttAnyr   r!    r   r   r   r      sE    &&&#2&?B&O^&fjklkpkpfq&#r   r   )r%   typingr*   Literalr'   r)   dictr&   r(   r+   OMFDataTyper   r,   r   r   <module>r1      sC    H ))FGtCH~&155k*# *#r   