我正在使用 codahale 指标(现在是 dropwizard 指标)来监控系统中发生的一些“事件”。我正在使用这些counters
指标来跟踪“事件”发生的次数。
我检查了记者为我的计数器指标打印的值,并且该值似乎在不断增加(并且永远不会下降)。这似乎是合乎逻辑的,因为每当我的“事件”发生时,我总是使用 metrics.inc() 函数。
What I really want is to get count of my 'event' happening between two reporting times
,为此,我每次报告指标时都需要重置我的计数器,但我在计数器指标中找不到任何选项来执行此操作。codahale 用户是否有办法或一般做法来生成此类指标?
当前行为(报告时间 10 秒):
00:00:00 0
00:00:10 2 // event happened twice
00:00:20 2 // event did not occur
00:00:30 5 // event occured three times`
预期指标:
00:00:00 0
00:00:10 2
00:00:20 0
00:00:30 3