【问题标题】:Graphing unique count of node in Graphite metric over time随着时间的推移,在 Graphite 度量中绘制节点的唯一计数
【发布时间】:2015-02-27 01:12:11
【问题描述】:

给定的 StatsD/Graphite 数据点看起来像这样

stats.counters.post.topic_1.user_1.count
stats.counters.post.topic_1.user_2.count
stats.counters.post.topic_2.user_3.count
stats.counters.post.topic_2.user_4.count

我正在尝试绘制 3 种不同的东西

  • 帖子数
  • 主题数
  • 发帖用户数

到目前为止,我已经收到了很多帖子

alias(summarize(sumSeries(stats.counters.post.*.*.count),"1hour"),"Total Posts")

对于主题和用户,我有点卡住了。

我可以通过这个获得每个主题的系列/行:

aliasByNode(summarize(groupByNode(stats.counters.post.*.*.count, 3, "sumSeries"), "1hour"), 0)

但是,这给出了每个主题的帖子数量,而不是主题的数量。

如何获得一段时间内的主题数量?由此,我确信我可以为用户应用同样的方法。

【问题讨论】:

    标签: metrics graphite statsd


    【解决方案1】:

    使用countSeries(*seriesList)石墨函数。

    独特主题的数量:

    countSeries(stats.counters.post.*.user_2.count)
    

    发帖的唯一用户数:

    countSeries(stats.counters.post.topic_2.*.count)
    

    【讨论】:

    • 我确实发现了这一点,而且看起来很有希望。但是,它不会跟踪数字随时间的变化,只是将最后一次计数显示为水平线。
    【解决方案2】:

    您可以offsetscaleSumSeries,这将使您随着时间的推移而改变,而不是一条直线。比如:

    alias(
      sumSeries(
        offset(
          scale(stats.counters.post.*.user_2.count, 0), 1)
        ), 'Total Number of Topics')
    

    更多信息请访问Counting the Number of Metrics Reported

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-03
      • 2018-06-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-16
      相关资源
      最近更新 更多