MCPcopy Index your code
hub / github.com/prometheus/client_python / test_histogram

Method test_histogram

tests/test_exposition.py:114–139  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

112""", generate_latest(self.registry))
113
114 def test_histogram(self):
115 s = Histogram('hh', 'A histogram', registry=self.registry)
116 s.observe(0.05)
117 self.assertEqual(b"""# HELP hh A histogram
118# TYPE hh histogram
119hh_bucket{le="0.005"} 0.0
120hh_bucket{le="0.01"} 0.0
121hh_bucket{le="0.025"} 0.0
122hh_bucket{le="0.05"} 1.0
123hh_bucket{le="0.075"} 1.0
124hh_bucket{le="0.1"} 1.0
125hh_bucket{le="0.25"} 1.0
126hh_bucket{le="0.5"} 1.0
127hh_bucket{le="0.75"} 1.0
128hh_bucket{le="1.0"} 1.0
129hh_bucket{le="2.5"} 1.0
130hh_bucket{le="5.0"} 1.0
131hh_bucket{le="7.5"} 1.0
132hh_bucket{le="10.0"} 1.0
133hh_bucket{le="+Inf"} 1.0
134hh_count 1.0
135hh_sum 0.05
136# HELP hh_created A histogram
137# TYPE hh_created gauge
138hh_created 123.456
139""", generate_latest(self.registry))
140
141 def test_gaugehistogram(self):
142 self.custom_collector(GaugeHistogramMetricFamily('gh', 'help', buckets=[('1.0', 4), ('+Inf', 5)], gsum_value=7))

Callers

nothing calls this directly

Calls 3

observeMethod · 0.95
HistogramClass · 0.90
generate_latestFunction · 0.90

Tested by

no test coverage detected