0

我正在使用 Graphite 和 Codahale 来记录我的 java 服务器的指标。我有一个看起来像这样的块代码:

public void foo() {
  try (Timer.Context ignored = myTimer.start()) {
    // Some code
  }
}

当我查看今天的事件计数(每个计时器也是一个计数器)时,我发现我们每分钟大约有数百次点击计数,这意味着每小时几千次。当我扩大日期范围以包括昨天时,我看到结果在数百万范围内,我不知道为什么。

结果显示在对度量进行 nonNegativeDerivative 操作之后

今天的结果:

今天

根据昨天的结果:

在此处输入图像描述

4

2 回答 2

3

如果使用 nonNegativeDerivative() - 请先应用导数,然后 sumSeries() - 反之亦然。请检查http://www.jilles.net/perma/2013/08/22/how-to-do-graphite-derivatives-correctly/

此外,您需要为计数器设置正确的聚合(总和),如http://obfuscurity.com/2012/05/A-Precautionary-Tale-for-Graphite-Users中所述

于 2017-03-07T15:06:47.177 回答
2

您不想在 dropwizard 计数器上使用 sum。您想使用“最后一个”,它们正在递增递减量规。您还需要 perSecond() 和 hitcount(10s) 而不是导数。

http://graphite.readthedocs.io/en/latest/functions.html#graphite.render.functions.perSecond

于 2017-04-05T17:46:59.500 回答