-
Notifications
You must be signed in to change notification settings - Fork 888
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
Add ability to *reset* metrics to 0 in UpDownCounter #3037
Comments
One problem with adding a |
It's because these measurements are additive: |
One way to work around it would be to use an async UpDownCounter, and have it track a stateful variable that you can set. |
Ah, yes, that makes sense. Thanks for clarifying that. |
Actually, the question is broader: No matter that we count, and no matter if we use sum/delta temporality, something can 'break' in the middle and we should start counting again from 0. |
I think what @mateuszrzeszutek pointed out above would be the best way to go about this: create a stateful variable and track the current value there. Use that variable in an async UpDownCounter and you should be able to reset it just by setting the value to 0. If the application crashes, set it to 0 (I assume this is what you mean by IIUC the way that the spec is currently written prohibits the introduction of a |
What are you trying to achieve?
I need to set the metric
db.client.connections.usage
to 0.What did you expect to see?
I expected to have a 'reset' function in the
UpDownCounter
object.I'm working on the metric
db.client.connections.usage
in mysql in JS. The metric logic is such that each time a connection is created, acquired, released or end, I add +1 or -1 to the metric ofused
oridle
connections.Now I have a case where the user is having x
used
connections and yidle
connections. and he is callingpool.end()
. In this case, I want to reset both metrics (used
&idle
) to 0.The text was updated successfully, but these errors were encountered: