opentelemetry-cpp icon indicating copy to clipboard operation
opentelemetry-cpp copied to clipboard

Prometheus exporter: Add text-based tests

Open dashpole opened this issue 2 years ago • 1 comments

Improve testing of the Prometheus exporter by comparing the serialized output with expectations.

In opentelemetry-go, tests are compared with the contents of a test file, such as https://github.com/open-telemetry/opentelemetry-go/blob/main/exporters/prometheus/testdata/gauge.txt

This makes it easy for anyone familiar with prometheus to determine if the test is producing the expected output, and clearly highlights any breaking changes to the final text format produced by the exporter. This is possible because prometheus does not include timestamps on metrics, making it possible to match the serialized output exactly on test runs.

I believe this could be accomplished by invoking Serialize on the produced metric families.

dashpole avatar Sep 27 '23 17:09 dashpole

This issue was marked as stale due to lack of activity.

github-actions[bot] avatar Dec 06 '23 01:12 github-actions[bot]