5

Given StatsD/Graphite data points that look like this

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

I'm trying to chart 3 different things

  • Number of posts
  • Number of topics
  • Number of users posting

So far I've got number of posts with

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

For topics and users, I'm a little stuck.

I can get a series/line per topic with this:

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

But, this gives the number of posts per topic, not the number of topics.

How would I get the number of topics over time? From that, I'm sure I can apply the same for users.

RyanW
  • 5,338
  • 4
  • 46
  • 58

3 Answers3

3

You can offset and scale a SumSeries which will give you your change over time rather than a flat line. Something like:

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

More on this at Counting the Number of Metrics Reported

Wolfwyrd
  • 15,716
  • 5
  • 47
  • 67
  • In my case this is somehow showing fractional values though, like 17.3 users... am I missing something here? The count over time should always be integers – Mr. Phil Oct 16 '22 at 15:23
2

Use the countSeries(*seriesList) Graphite function.

Number of unique topics:

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

Number of unique users posting:

countSeries(stats.counters.post.topic_2.*.count)
dukebody
  • 7,025
  • 3
  • 36
  • 61
  • 10
    I did find that and it seemed promising. But, it doesn't track change of the number over time, just shows the last count as a horizontal line. – RyanW Mar 05 '15 at 21:57
  • 1
    Yes for me the countSeries's result didn't change if I changed the time interval. Can I use some other function instead of it ? – Deepak Patankar Oct 13 '22 at 10:30
0

Came across the same issue with countSeries. I wanted something across time. For me the solution was:

sum(isNonNull(groupByNodes(stats.counters.post.*.*.count, "sum", -3)))
gagou7
  • 293
  • 3
  • 12