mikejihbe / metrics

A metrics library for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there any way to reset the Metrics Counter/Timer once its reported to Graphite/console

priyavivek1 opened this issue · comments

I assume you want to reset them because it is Graphite that does aggregation over time so you are only interested in measuring the number of new occurrences / ... since the latest report, right?

I have the same need. I fixed it by resetting counters manually (I have my own, modified InfluxReporter with a metricReportedHook that I can use to reset a metric). I believe it is not necessary to update meters as they do and should report the rate in the past 1/5/15 min and are updating themselves (decaying the value) provided you remember to call .tick every 5s (see #37). Though I need to think more about this :).

It would be nice if metrics had support for this built in. I am sure the author would welcome a PR :).

👍 sounds like a good idea, maybe a top level option in ScheduledReporter to control this would be nice.