Skip to content

Commit

Permalink
[api] allow graphite to take an options.meta which is a key of a me…
Browse files Browse the repository at this point in the history
…ta property to insert into graphite (it assumes its a Number) or defaults to `data.metric`
  • Loading branch information
jcrugzz committed May 25, 2013
1 parent 7b5f78f commit a2af521
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/godot/reactor/graphite.js
Expand Up @@ -42,6 +42,7 @@ var Graphite = module.exports = function Graphite(options) {
this.url = options.url;
this.prefix = options.prefix || 'godot';
this.interval = options.interval || 60000;
this.meta = options.meta || null;
this._last = 0;

this.client = options.client || graphite.createClient(this.url);
Expand Down Expand Up @@ -79,7 +80,7 @@ Graphite.prototype.write = function (data) {
data.state
);

metrics[metricName] = data.metric
metrics[metricName] = this.meta ? data.meta[this.meta] : data.metric;
this.client.write(metrics, data.time, function (err) {
self._last = now;

Expand Down

0 comments on commit a2af521

Please sign in to comment.