Reputation: 343
I Want to reset the counter to 0 in prometheus push gateway because prometheus push gateway will keep on sending last counter value to prometheus. i don't that to be happen in my condition.
Upvotes: 1
Views: 6229
Reputation: 6863
From what I understand, your question is that you push some metric (a counter) but you don't want this metric to stay forever in the push gateway. The bottom line is that there is no timeout on metrics in push gateway and there won't be in the foreseeable future.
If possible, you can schedule a DELETE request in order to remove the metric (rather than reset it) after the time you want. A popular method is also to use a textfile tied to a node exporter which will disappear with your node. It depends on your environment and setup.
Upvotes: 3
Reputation: 316
According to Prometheus docs (Counter and Gauge), I guess Gauge fits better into your problem, because according to this doc of prometheus_client counter for python,
Counters go up and reset when the process restarts.
So it's unlikely that you can set 0 value for Counter.
But Gauges can go up and down and set a certain value like 0.
Upvotes: 0