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

Method validate_metrics

tests/test_wsgi.py:46–55  ·  view source on GitHub ↗

WSGI app serves the metrics from the provided registry.

(self, metric_name, help_text, increments)

Source from the content-addressed store, hash-verified

44 self.assertIn(metric_name + "_total " + str(increments) + ".0\n", output)
45
46 def validate_metrics(self, metric_name, help_text, increments):
47 """
48 WSGI app serves the metrics from the provided registry.
49 """
50 self.increment_metrics(metric_name, help_text, increments)
51 # Create and run WSGI app
52 app = make_wsgi_app(self.registry)
53 outputs = app(self.environ, self.capture)
54 # Assert outputs
55 self.assert_outputs(outputs, metric_name, help_text, increments, compressed=False)
56
57 def test_report_metrics_1(self):
58 self.validate_metrics("counter", "A counter", 2)

Callers 4

test_report_metrics_1Method · 0.95
test_report_metrics_2Method · 0.95
test_report_metrics_3Method · 0.95
test_report_metrics_4Method · 0.95

Calls 3

increment_metricsMethod · 0.95
assert_outputsMethod · 0.95
make_wsgi_appFunction · 0.90

Tested by

no test coverage detected