K'ao
K'ao

Reputation: 330

Graphite - use multiple series with DivideSeries

I'm trying to use Graphite to compute a CTR for all my resources, so I tried recording my data like this:

So first, I made my query :

&target= averageSeries(divideSeries(ctr.176983011340976128.clicks,ctr.176983011340976128.reach),divideSeries(ctr.190348137012011008.clicks,ctr.190348137012011008.reach))

My problem here is that I don't want to send all my resource ids to graphite, so I tried :

&target= averageSeries(divideSeries(ctr.*.clicks,ctr.*.reach))

But yeah, as the documentation says "ValueError: divideSeries second argument must reference exactly 1 series".

I tried an alternative architecture :

But same problem…

I'm new with Graphite, so if anyone has a solution, it will be amazing!

Edit:

Just saw the function groupByNode, trying to use it…

Upvotes: 2

Views: 3306

Answers (1)

Harry Park
Harry Park

Reputation: 429

Sounds like you need to aggregate your data into a series beforehand so you can pass it to divideSeries.

Aggregator-rules.conf reference in the Configuring Carbon docs: http://graphite.readthedocs.org/en/latest/config-carbon.html

So you'd need 2 rules like this to sum up the click data per min: ctr.resource_all.clicks (60) = sum ctr.*.clicks ctr.resource_all.reach (60) = sum ctr.*.reach

You'll also have to run the carbon-aggregator.py daemon /opt/graphite/bin/carbon-aggregator.py start

The default port for the aggregator daemon is 2023, so that's where you should send your traffic instead of the 2003 port you've been using.

Upvotes: 1

Related Questions