-
Notifications
You must be signed in to change notification settings - Fork 849
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
Inconsistent Prometheus exporter timestamp handling between Java and C++ #5997
Comments
Moving to opentelemetry-java, since opentelemetry-java-instrumentation doesn't contain the prometheus exporter. |
@dashpole / @jsuereth Could use some guidance on this. #3700 added timestamps to the prometheus exporter after discussion in #3696, but that appears to be in conflict with OpenMetrics, and maybe the prometheus compatibility spec. Is this behavior something that should be deleted, or opt-in, or adjusted in the spec? |
Prometheus recommends against using explicit timestamps. We should clarify the correct behavior in the spec (I thought it was, but can't find it). Using explicit timestamps is reserved for "collector-like" scenarios, where data collected elsewhere is being re-exposed. For an application with its own instrumentation, explicit timestamps are almost never the right thing to do. One example of where it would possibly be appropriate to use explicit timestamps would be if you were periodically (e.g. every 10 minutes) querying something, caching the result, and then had an async callback that returned the cached value. But unless there is a significant difference between when something was actually observed, and when the scrape happens, you wouldn't want to add explicit timestamps. I'm OK with allowing explicit timestamps to be turned on, but it needs to be off by default. exporters shouldn't be required to support that configuration. |
👍 Seems reasonable to me. We can make this an opt in feature of prometheus exporter. |
You're right, the timestamp represents the scrape time, and this should be set by the Prometheus server, not by the client library.
This example makes sense. Note however that in that case the timestamp should be the time when the callback was called, not the scrape timestamp. Afaik OpenTelemetry does not provide API to set the timestamp explicitly, therefore this cannot be implemented anyway.
I think an opt in feature only makes sense if there is API to explicitly set the timestamp. An opt in feature where the scrape time is set automatically during scrape wouldn't be useful. Anyway, Just a heads-up: I'm currently finalizing #5940, and if that gets merged it will remove the timestamp. |
PR #6015 would fix this. |
Thats a good point. I support prohibiting SDK prometheus exporters from adding timestamps in that case. |
Is your feature request related to a problem? Please describe.
The C++ Prometheus exporter has an issue resolved where they disable timestamps, referencing the specification.
The same behaviour is present in Java Prometheus exporter 1.31.0 , possibly enabled on request (not sure if that's the case). Not all metrics have timestamps set.
Describe the solution you'd like
If the team at C++ repo is wrong, let them know 😸
Describe alternatives you've considered
No response
Additional context
Java Agent 1.31.0
The text was updated successfully, but these errors were encountered: