RyanW
RyanW

Reputation: 5398

Graphing unique count of node in Graphite metric over time

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

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.

Upvotes: 5

Views: 5337

Answers (3)

gagou7
gagou7

Reputation: 313

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)))

Upvotes: 0

Wolfwyrd
Wolfwyrd

Reputation: 15906

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

Upvotes: 4

dukebody
dukebody

Reputation: 7185

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)

Upvotes: 2

Related Questions