5

I have a question regarding Graphite, which I'm using with statsD in node.js.

I have a server that I'm, going to run several instances of, and I would like to aggregate statistics like the following among all instances:

  • Mean response time
  • Number of active clients

Right now each instance will get its own folder, as it starts with its own graphs, because the code is:

stats.gauge('requestsPerSecond', reqCounter);

Could I do something like stats('/myServ/aggregates', reqCounter); as well so that each instance will send its data to the same graph in graphite besides keeping track of its own graphs using stats.gauge('requestsPerSecond', reqCounter);?

Joshua Dwire
  • 5,415
  • 5
  • 29
  • 50
codealot
  • 53
  • 5
  • Why not let Graphite aggregate the data while [rendering](http://graphite.readthedocs.org/en/1.0/functions.html#graphite.render.functions.sumSeries)? – cmur2 Oct 02 '13 at 19:27
  • Ok but this is isn't in the statsd code this is the graphite code right? How would i trigger this code from node.js stats.sumSeries(myServ.requestsPerSecond.*,reqCounter). Not sure how to do it i havent seen the graphite code itself because i'm not managing that part i'm a node.js developer maybe you could give me a hint? – codealot Oct 03 '13 at 07:42
  • Oh, I'm sorry I'm no statsd expert. The idea above assumes that the aggregation is done in graphite rendering, not sure if there is a statsd-only way. – cmur2 Oct 03 '13 at 11:02

1 Answers1

1

I'm not 100% sure what you are trying to do. But in general you can't send the same metric from multiple StatsD instances to the same Graphite server. Graphite only stores the last one arriving in the time window for the highest precision archive. So multiple StatsD instances would overwrite each other. You can however set a server specific prefix (https://github.com/etsy/statsd/blob/master/exampleConfig.js#L67) in the StatsD config that will prepended to the metrics string.

mrtazz
  • 181
  • 2
  • Yeah i have tried a lot actually and even though i manage to get the data to the same graph the instances will override eachothers data because graphite chooses the latest. I'm not sure I'm with you about the prefix what how will it help me? – codealot Oct 04 '13 at 06:08
  • because then the metric names won't be the same anymore but rather something like `stats.statsd01.logins`. This means you will have a distinct metric path for each metric from an instance and can show aggregates in graphite with something like `sumSeries(stats.statsd*.logins)` – mrtazz Oct 08 '13 at 18:15