1ji.~ddlZddlmZdZejdZejdZejdZGdd eZ Gd d e Z e Z Gd d e Z Gdde Z Gdde ZGdde ZGdde ZGdde ZGdde ZdS)N)Sample)countergaugesummary histogramgaugehistogramunknowninfostatesetz^[a-zA-Z_:][a-zA-Z0-9_:]*$z^[a-zA-Z_][a-zA-Z0-9_]*$z^__.*$c.eZdZdZddZd dZdZdZdS) MetriczA single metric family and its samples. This is intended only for internal use by the instrumentation client. Custom collectors should use GaugeMetricFamily, CounterMetricFamily and SummaryMetricFamily instead. c.|r |d|zs|d|zz }t|std|z||_||_||_|dkrd}|tvrtd|z||_g|_ dS)N_zInvalid metric name: untypedr zInvalid metric type: ) endswithMETRIC_NAME_REmatch ValueErrorname documentationunit METRIC_TYPEStypesamples)selfrrtyprs p/builddir/build/BUILD/cloudlinux-venv-1.0.11/venv/lib/python3.11/site-packages/prometheus_client/metrics_core.py__init__zMetric.__init__s   cDj11  C$J D##D)) =4t;<< < * )  C l " "4s:;; ;  Nc \|jt|||||dS)z?Add a sample to the metric. Internal-only, do not use.N)rappendr)rrlabelsvalue timestampexemplars r add_samplezMetric.add_sample&s0 F4 8LLMMMMMr!ct|toO|j|jko?|j|jko/|j|jko|j|jko|j|jkSN) isinstancerrrrrr)rothers r__eq__z Metric.__eq__,sq5&)). UZ'."e&99. UZ'. UZ' .   -  /r!c Xd|jd|jd|jd|jd|jd S)NzMetric(z, ))rrrrr)rs r__repr__zMetric.__repr__4s> III     III III LLL   r!)rNN)__name__ __module__ __qualname____doc__r r(r-r0r!rrrsh    NNNN ///     r!rc"eZdZdZddZddZdS)UnknownMetricFamilyzOA single unknown metric and its samples. For use by custom collectors. Nrct|||d|||td|g}t||_||g|dSdS)Nr 1Can only specify at most one of value and labels.rr rtuple _labelnames add_metricrrrr%r$rs rr zUnknownMetricFamily.__init__CsvdM9dCCC  %"3PQQ Q >F ==   OOB & & & & &  r!c |jt|jt t |j|||dS)zAdd a metric to the metric family. Args: labels: A list of label values value: The value of the metric. Nrr#rrdictzipr=rr$r%r&s rr>zUnknownMetricFamily.add_metricMsG F49d3t7G3P3P.Q.QSXZcddeeeeer!NNrr*r2r3r4r5r r>r6r!rr8r8>sL''''ffffffr!r8c"eZdZdZddZddZdS)CounterMetricFamilyzIA single counter and its samples. For use by custom collectors. Nrc |dr |dd}t|||d|||td|g}t ||_||g||dSdS)N_totalirr:)rrr rr<r=r>)rrrr%r$createdrs rr zCounterMetricFamily.__init__`s == " " 9DdM9dCCC  %"3PQQ Q >F ==   OOBw / / / / /  r!c V|jt|jdzt t |j||||T|jt|jdzt t |j|||dSdS)zAdd a metric to the metric family. Args: labels: A list of label values value: The value of the metric created: Optional unix timestamp the child was created at. rJN_createdrA)rr$r%rKr&s rr>zCounterMetricFamily.add_metricms F49x#7c$BRTZ>[>[9\9\^cenooppp   L  ty:'=tCHXZ`DaDa?b?bdkmv w w x x x x x  r!NNNrr1rFr6r!rrHrHZsL 0 0 0 0 y y y y y yr!rHc"eZdZdZddZddZdS)GaugeMetricFamilyzGA single gauge and its samples. For use by custom collectors. Nrct|||d|||td|g}t||_||g|dSdS)Nrr:r;r?s rr zGaugeMetricFamily.__init__svdM7DAAA  %"3PQQ Q >F ==   OOB & & & & &  r!c |jt|jt t |j|||dS)z|Add a metric to the metric family. Args: labels: A list of label values value: A float NrArDs rr>zGaugeMetricFamily.add_metricsG F49d3t7G3P3P.Q.QSXZcddeeeeer!rEr*rFr6r!rrPrPzsL ''''ffffffr!rPc"eZdZdZddZddZdS)SummaryMetricFamilyzIA single summary and its samples. For use by custom collectors. Nrct|||d||du|dukrtd||td|g}t||_||g||dSdS)Nrz4count_value and sum_value must be provided together.r:r;)rrr count_value sum_valuer$rs rr zSummaryMetricFamily.__init__sdM9dCCC  ;$#6 7 7STT T  +"9PQQ Q >F ==  " OOB Y 7 7 7 7 7 # "r!c N|jt|jdzt t |j||||jt|jdzt t |j|||dS)zAdd a metric to the metric family. Args: labels: A list of label values count_value: The count value of the metric. sum_value: The sum value of the metric. _count_sumNrA)rr$rVrWr&s rr>zSummaryMetricFamily.add_metrics F49x#7c$BRTZ>[>[9\9\^iktuuvvv F49v#5tC@PRXF ==   OOB 3 3 3 3 3  r!c|D]}|dd\}}d}t|dkr|d}|jt|jdzt t t|j|d|fgz||||jt|jdzt t|j||dd|t|d d d krV|V|jt|jd zt t|j|||dSdSdS) azAdd a metric to the metric family. Args: labels: A list of label values buckets: A list of lists. Each inner list can be a pair of bucket name and value, or a triple of bucket name, value, and exemplar. The buckets must be sorted, and +Inf present. sum_value: The sum value of the metric. N_bucketlerYrrrZ) lenrr#rrrBlistrCr=float) rr$r_rWr&bbucketr%r's rr>z HistogramMetricFamily.add_metrics  AbqbEMFEH1vv{{Q4 L   I%T#d.7788T6N;KKLL !!     ty8+T#d6F2O2O-P-PRYZ\R]^_R`bkll n n n A  1 $ $)> L  49v-tC8H&4Q4Q/R/RT]_hii k k k k k % $)>)>r!rNr*rFr6r!rr\r\sL 4 4 4 4kkkkkkr!r\c"eZdZdZddZddZdS)GaugeHistogramMetricFamilyzQA single gauge histogram and its samples. For use by custom collectors. Nrct|||d|||td|g}t||_||g||dSdS)Nr r^r;)rrrr_ gsum_valuer$rs rr z#GaugeHistogramMetricFamily.__init__sydM3CTJJJ  '"5RSS S >F ==   OOB 4 4 4 4 4  r!c|D]j\}}|jt|jdzt t t |j|d|fgz||k|jt|jdzt t |j||dd|t|jdzt t |j|||gdS)aAdd a metric to the metric family. Args: labels: A list of label values buckets: A list of pairs of bucket names and values. The buckets must be sorted, and +Inf present. gsum_value: The sum value of the metric. rcrd_gcountrer_gsumN) rr#rrrBrgrCr=extend)rr$r_rnr&rjr%s rr>z%GaugeHistogramMetricFamily.add_metrics% # #MFE L   I%T#d.7788T6N;KKLLy!"!" # # # #  49y($s43CV/L/L*M*MwWY{[\~_h i i 49w&S1A6-J-J(K(KZYb c c      r!rNr*rFr6r!rrlrlsF 5555      r!rlc"eZdZdZddZddZdS)InfoMetricFamilyzFA single info and its samples. For use by custom collectors. Nct|||d||td|g}t||_||g|dSdS)Nr r:r;rrrr%r$s rr zInfoMetricFamily.__init__stdM6:::  %"3PQQ Q >F ==   OOB & & & & &  r!c |jt|jdzt t t |j|fi|d|dS)zAdd a metric to the metric family. Args: labels: A list of label values value: A dict of labels _inforNrArDs rr>zInfoMetricFamily.add_metricsl F I  c$*F3344 > > > >         r!r1r*rFr6r!rrtrt sF ''''       r!rtc"eZdZdZddZddZdS)StateSetMetricFamilyzJA single stateset and its samples. For use by custom collectors. Nct|||d||td|g}t||_||g|dSdS)Nr r:r;rvs rr zStateSetMetricFamily.__init__/stdM:>>>  %"3PQQ Q >F ==   OOB & & & & &  r!c 6t|}t|D]g\}}|rdnd}|jt |jtt|j |jfz||fz||hdS)zAdd a metric to the metric family. Args: labels: A list of label values value: A dict of string state names to booleans rrN) r<sorteditemsrr#rrrBrCr=)rr$r%r&stateenabledvs rr>zStateSetMetricFamily.add_metric9sv$U[[]]33  NE7$1A L   S)TYL8&E8:KLLMM !!      r!r1r*rFr6r!rrzrz)sF ''''r!rz)rerrrcompilerMETRIC_LABEL_NAME_RERESERVED_METRIC_LABEL_NAME_REobjectrr8UntypedMetricFamilyrHrPrTr\rlrtrzr6r!rrs  9::!rz"=>> * 9 5 5- - - - - V- - - `fffff&fff2*yyyyy&yyy@ffffffff4sssss&sss6r!