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

Method test_histogram_labels

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

Source from the content-addressed store, hash-verified

818 self.assertEqual(3, self.registry.get_sample_value('h_sum', {}))
819
820 def test_histogram_labels(self):
821 cmf = HistogramMetricFamily('h', 'help', labels=['a'])
822 cmf.add_metric(['b'], buckets=[('0', 1), ('+Inf', 2)], sum_value=3)
823 self.custom_collector(cmf)
824 self.assertEqual(1, self.registry.get_sample_value('h_bucket', {'a': 'b', 'le': '0'}))
825 self.assertEqual(2, self.registry.get_sample_value('h_bucket', {'a': 'b', 'le': '+Inf'}))
826 self.assertEqual(2, self.registry.get_sample_value('h_count', {'a': 'b'}))
827 self.assertEqual(3, self.registry.get_sample_value('h_sum', {'a': 'b'}))
828
829 def test_gaugehistogram(self):
830 self.custom_collector(GaugeHistogramMetricFamily('h', 'help', buckets=[('0', 1), ('+Inf', 2)]))

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