Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Resetable counter #35

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Resetable counter #35

wants to merge 3 commits into from

Conversation

krukru
Copy link
Contributor

@krukru krukru commented Dec 30, 2016

I couldn't find a way to reset the counter values to zero (since they persist in Redis/APC) so I added a reset method.

@bracki
Copy link
Contributor

bracki commented Nov 6, 2017

What's your use case for resetting counters?

@krukru
Copy link
Contributor Author

krukru commented Nov 6, 2017

For example, we keep track of the number of successful/failed http requests since the last server restart. I guess that this could be handled with a workaround (labels), but it seemed just practical to reset the counters on a server crash and start counting again from 0.

@bracki
Copy link
Contributor

bracki commented Nov 6, 2017

Ah, so you want to reset metrics in Redis, correct? Because with APC they would automatically be resetted.

@krukru
Copy link
Contributor Author

krukru commented Nov 6, 2017

Right, APC would be reset since it is not persistent. But Redis (and a theoretical File Storage adapter) would require this to be reset.

@bracki
Copy link
Contributor

bracki commented Nov 6, 2017

OK, but wouldn't it make sense than to add this to every possible metric?

@krukru
Copy link
Contributor Author

krukru commented Nov 6, 2017

Well, you are right on that account :)
If you think this is a good PR I can update it to include other metrics as well (not just Counter)

@jitendra-1217
Copy link

But how does it matter to prometheus, it anyway handles counter resets doing some normalisation, right?
I am just curious how do you end up using this data.

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

Successfully merging this pull request may close these issues.

3 participants