PromPHP / prometheus_client_php

Prometheus instrumentation library for PHP applications
https://prometheus.io/docs/concepts/metric_types/
Apache License 2.0
415 stars 91 forks source link

Can I reset a counter on purpose? #119

Closed fideloper closed 1 year ago

fideloper commented 1 year ago

I'm counting a metric that resets to zero every month (coinciding with billing for our app). It seems like I don't have a way to purposely reset a counter to zero - is that correct? (Maybe this is a hint that a Gauge makes more sense?).

For context, we have usage based billing and I'm interested in graphing that (resets to zero at the beginning of each month).

LKaemmerling commented 1 year ago

I this case a gauge would be better for your case. The definition from Prometheus is that a counter should only be reset on Programm restart.

LKaemmerling commented 1 year ago

Hey @fideloper did this answer your question :)?

fideloper commented 1 year ago

Yes, thank you very much!

On Mon, Apr 24, 2023 at 13:38 Lukas Kämmerling @.***> wrote:

Hey @fideloper https://github.com/fideloper did this answer your question :)?

— Reply to this email directly, view it on GitHub https://github.com/PromPHP/prometheus_client_php/issues/119#issuecomment-1520574141, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADSDU2MO2BGMLXOC3PYBD3XC23BHANCNFSM6AAAAAAXFTABVM . You are receiving this because you were mentioned.Message ID: @.***>

LKaemmerling commented 1 year ago

Okay then i will close the issue :)