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

Method test_native_histogram

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

Source from the content-addressed store, hash-verified

207 self.assertEqual([hfm], list(families))
208
209 def test_native_histogram(self):
210 families = text_string_to_metric_families("""# TYPE nativehistogram histogram
211# HELP nativehistogram Is a basic example of a native histogram
212nativehistogram {count:24,sum:100,schema:0,zero_threshold:0.001,zero_count:4,positive_spans:[0:2,1:2],negative_spans:[0:2,1:2],positive_deltas:[2,1,-3,3],negative_deltas:[2,1,-2,3]}
213# EOF
214""")
215 families = list(families)
216
217 hfm = HistogramMetricFamily("nativehistogram", "Is a basic example of a native histogram")
218 hfm.add_sample("nativehistogram", None, None, None, None, NativeHistogram(24, 100, 0, 0.001, 4, (BucketSpan(0, 2), BucketSpan(1, 2)), (BucketSpan(0, 2), BucketSpan(1, 2)), (2, 1, -3, 3), (2, 1, -2, 3)))
219 self.assertEqual([hfm], families)
220
221 def test_native_histogram_utf8(self):
222 families = text_string_to_metric_families("""# TYPE "native{histogram" histogram

Callers

nothing calls this directly

Calls 5

NativeHistogramClass · 0.85
BucketSpanClass · 0.85
add_sampleMethod · 0.80

Tested by

no test coverage detected