How to reset the Counter Variable to zero after it is changed to certain value.?
veerusajjan opened this issue · comments
veerusajjan commented
from prometheus_client import Counter
Create a Counter metric
match_counter = Counter('analyzer_match_counter', 'Number of matches',
['pattern', 'duration'])
Function to update the match_counter variable
def update_match_counts(self, regex_pattern, duration, count):
match_counter.labels(pattern=pattern, duration=str(duration)).inc(count)
Now I have increased the value of match_counter variable by count.
After certain duration, I need to reset the value of match_counter to zero.
Can you help me out how to reset the value this.?
What all the options are available in Counter module to do this.?
Chris Marchbanks commented
There is no way to do this today (other recreating the metric). There is a request to add this in #995 .