MCPcopy Create free account
hub / github.com/prometheus/client_python / test_gaugehistogram_labels

Method test_gaugehistogram_labels

tests/test_core.py:834–841  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

832 self.assertEqual(2, self.registry.get_sample_value('h_bucket', {'le': '+Inf'}))
833
834 def test_gaugehistogram_labels(self):
835 cmf = GaugeHistogramMetricFamily('h', 'help', labels=['a'])
836 cmf.add_metric(['b'], buckets=[('0', 1), ('+Inf', 2)], gsum_value=3)
837 self.custom_collector(cmf)
838 self.assertEqual(1, self.registry.get_sample_value('h_bucket', {'a': 'b', 'le': '0'}))
839 self.assertEqual(2, self.registry.get_sample_value('h_bucket', {'a': 'b', 'le': '+Inf'}))
840 self.assertEqual(2, self.registry.get_sample_value('h_gcount', {'a': 'b'}))
841 self.assertEqual(3, self.registry.get_sample_value('h_gsum', {'a': 'b'}))
842
843 def test_info(self):
844 self.custom_collector(InfoMetricFamily('i', 'help', value={'a': 'b'}))

Callers

nothing calls this directly

Calls 4

add_metricMethod · 0.95
custom_collectorMethod · 0.95
get_sample_valueMethod · 0.80

Tested by

no test coverage detected