Option to reset counter
See original GitHub issueHi
I have a application that process data on a recurring base (scheduled task).
At the start i want to set/export all counter to 0.
If a counter has no label, its working fine (the counter gets exported with 0).
But I see no way to set a counter to 0, if it has a label.
Maybe a Reset()
method on the counter could do that:
var counter = metricFactory.CreateCounter("myCounter", "help text", labelNames: new []{ "method", "endpoint"});
counter.WithLabels("GET", "/").Reset();
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
counter-reset
The counter-reset property is used to reset a CSS counter to a given value. It is part of the CSS counter module which...
Read more >Reset account lockout counter after - Windows Security
The Reset account lockout counter after policy setting determines the number of minutes that must elapse from the time a user fails to...
Read more >How to reset/set an individual or total counter? - speedohelp
If you want to reset all current counters this is easy. Just invoke the menu, and use reset counters option. But what if...
Read more >CSS counter-reset property
The counter-reset property creates or resets one or more CSS counters. The counter-reset property is usually used together with the counter-increment ...
Read more >Resetting a Counter
Click on Reset [Type] Counter. Alternatively, choose File -> Capture Counter -> Reset Counter from the main menu. The selected counter will be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@sanych-sun Yes the given sample works for me. I just call
.WithLabels()
and the counter gets initalized with 0. Thanks.Hi
If you are using v4 of the library you can just call WithLabels by providing your labels combination on start and it should be reported with 0 value.
var counter = metricFactory.CreateCounter("myCounter", "help text", labelNames: new []{ "method", "endpoint"}); counter.WithLabels("GET", "/");
Or if you want to have unlabelled sample reported - access to the Unlabelled property.
var counter = metricFactory.CreateCounter("myCounter", "help text", labelNames: new []{ "method", "endpoint"}); counter.Unlabelled;