opentelemetry-cpp
opentelemetry-cpp copied to clipboard
Prometheus exporter: Add text-based tests
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.
This issue was marked as stale due to lack of activity.