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

Method test_counter_exemplars

tests/openmetrics/test_parser.py:370–378  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

368 self.assertEqual([hfm], list(families))
369
370 def test_counter_exemplars(self):
371 families = text_string_to_metric_families("""# TYPE a counter
372# HELP a help
373a_total 0 123 # {a="b"} 0.5
374# EOF
375""")
376 cfm = CounterMetricFamily("a", "help")
377 cfm.add_sample("a_total", {}, 0.0, Timestamp(123, 0), Exemplar({"a": "b"}, 0.5))
378 self.assertEqual([cfm], list(families))
379
380 def test_counter_exemplars_utf8(self):
381 families = text_string_to_metric_families("""# TYPE "a.b" counter

Callers

nothing calls this directly

Calls 5

CounterMetricFamilyClass · 0.90
TimestampClass · 0.85
ExemplarClass · 0.85
add_sampleMethod · 0.80

Tested by

no test coverage detected