Replies: 1 comment
-
Well, now that I give it another though, this might be tricky because of labels/attributes: we'd like initial values for some/all attributes but OpenTelemetry has no way to know them. I guess that's the explanation. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
From https://stackoverflow.com/questions/77349938/how-to-enforce-initial-value-zero-is-exported-to-prometheus-with-opentelemetry
Considering the following simple counter:
As long as we don't increment the value of the counter (with
.add(1, ...)
for instance), the counter value is not visible to Prometheus scraping.Using
.add(0)
at startup/initialization works as a trick, but shouldn't counters expose their initial value without having to do that? Or at least have an opt-in possibility to do it in the counter definition maybe?Something like:
For completeness, here's the code we use to expose metrics to Prometheus thanks to OpenTelemetry Prometheus module:
I don't know if this a core OpenTelemetry thing, or specific to Java, or even specific to the Prometheus Exporter.
Beta Was this translation helpful? Give feedback.
All reactions