U mf @s$ddlmZdZddZddZdS))floatToGoStringz:application/openmetrics-text; version=1.0.0; charset=utf-8cCs8|jdkr|jdrdS|jdkr4|jdr4dSdS)NcounterZ_totalT)Z histogramZgaugehistogramZ_bucketF)typenameendswith)metricsampler V/opt/hc_python/lib/python3.8/site-packages/prometheus_client/openmetrics/exposition.py_is_valid_exemplar_metric s r c Csg}|D]}zv|j}|d||jdddddd|d|d |jd|jr|d |d |jd|jD]}|j rd d d dt |j D}nd}|j rFt||std|jdd d ddt |j j D}|j jdk r0d|t|j j|j j}nd|t|j j}nd}d}|jdk rfd |j}|d|j|t|j||qWq tk r} z| jpd|f| _W5d} ~ XYq Xq |dd |dS)zHReturns the metrics from the registry in latest text format as a string.z # HELP {} {} \\\ \n"\"z# TYPE  z# UNIT z{{{0}}},c Ss4g|],\}}d||ddddddqSz{}="{}"r r rrrrformatreplace.0kvr r r s z#generate_latest..zMetric z8 has exemplars, but is not a histogram bucket or counterc Ss4g|],\}}d||ddddddqSrrrr r r r)s Nz # {} {} {}z # {} {}z {}{} {}{}{} )rz# EOF zutf-8)Zcollectrappendr documentationrrunitZsampleslabelsjoinsorteditemsZexemplarr ValueError timestamprvalue Exceptionargsencode) registryoutputrZmnamesZlabelstrr!Z exemplarstrr& exceptionr r r generate_latestsj         r/N)utilsrZCONTENT_TYPE_LATESTr r/r r r r s