2

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

  • ctr.resource_id.clicks
  • ctr.resource_id.reach

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 :

  • ctr.clicks.resource_id
  • ctr.reach.resource_id

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…

K'ao
  • 330
  • 1
  • 3
  • 13

1 Answers1

1

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.

Harry Park
  • 429
  • 4
  • 10