Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider support for testing exemplars in prometheus/testutil #1479

Open
dashpole opened this issue Mar 27, 2024 · 4 comments
Open

Consider support for testing exemplars in prometheus/testutil #1479

dashpole opened this issue Mar 27, 2024 · 4 comments

Comments

@dashpole
Copy link

Context: open-telemetry/opentelemetry-go#5111

I am in the process of adding exemplar support to the OpenTelemetry-go prometheus exporter. We currently use testutil.GatherAndCompare for most of our testing, as it makes it easy to tell if the output is correct.

However, since GatherAndCompare currently uses the Prometheus text format, and the Prometheus text format doesn't support exemplars, I can't test using the same mechanism. Assuming exemplars aren't coming to the text format soon, the options to resolve this are:

  1. Re-implement GatherAndCompare in my own tests, and make it use OpenMetrics text format, instead of the Prometheus text format.
  2. Write unit test assertions on the go-protobuf types from prometheus.Metric.Write() to check for exemplars separately.
  3. Extend testutil to support gathering the OpenMetrics text format.

Before I move forward with 1 or 2, I figured I would check to see if extending testutil to support my use-case makes sense to maintainers.

@ArthurSens
Copy link
Member

Thanks for the heads up!

I'm in favor of option 3 actually, but we would need to send PRs to prometheus/common first. We'd need a textparser for OpenMetrics, similar to this one, then bump prometheus/common here.

Bumping prometheus/common leads us to another problem: common doesn't work with go1.20 and client Golang promises support for the 3 latest go versions. We would need to wait until go 1.23 is out :/

@ArthurSens
Copy link
Member

If you need this solved ASAP, I'd suggest you move forward with making test asserting with the protobuf types, but extending the test utility libraries is definitely a positive thing.

1.23 is scheduled to August, so it might take a while 😬

@dashpole
Copy link
Author

Thanks! I'll leave this open, and pursue option 2.

@ArthurSens
Copy link
Member

prometheus/common with go 1.20 again, there are no blockers for this now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants