Skip to content

Commit

Permalink
Merge pull request #148 from ktheory/optional_counts
Browse files Browse the repository at this point in the history
Optionally omit stats_counts metrics
  • Loading branch information
draco2003 committed Aug 2, 2013
2 parents e4c957f + ca3ab5c commit ce6ec09
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions backends/graphite.js
Expand Up @@ -24,6 +24,7 @@ var debug;
var flushInterval;
var graphiteHost;
var graphitePort;
var flush_counts;

// prefix configuration
var globalPrefix;
Expand Down Expand Up @@ -102,10 +103,14 @@ var flush_stats = function graphite_flush(ts, metrics) {

if (legacyNamespace === true) {
statString += namespace.join(".") + ' ' + valuePerSecond + ts_suffix;
statString += 'stats_counts.' + key + ' ' + value + ts_suffix;
if (flush_counts) {
statString += 'stats_counts.' + key + ' ' + value + ts_suffix;
}
} else {
statString += namespace.concat('rate').join(".") + ' ' + valuePerSecond + ts_suffix;
statString += namespace.concat('count').join(".") + ' ' + value + ts_suffix;
if (flush_counts) {
statString += namespace.concat('count').join(".") + ' ' + value + ts_suffix;
}
}

numStats += 1;
Expand Down Expand Up @@ -227,6 +232,8 @@ exports.init = function graphite_init(startup_time, config, events) {

flushInterval = config.flushInterval;

flush_counts = typeof(config.flush_counts) === "undefined" ? true : config.flush_counts;

events.on('flush', flush_stats);
events.on('status', backend_status);

Expand Down
2 changes: 2 additions & 0 deletions exampleConfig.js
Expand Up @@ -32,6 +32,8 @@ Optional Variables:
(can be a single value or list of floating-point values)
negative values mean to use "top" Nth percentile(s) values
[%, default: 90]
flush_counts: send stats_counts metrics [default: true]
keyFlush: log the most frequently sent keys [object, default: undefined]
interval: how often to log frequent keys [ms, default: 0]
percent: percentage of frequent keys to log [%, default: 100]
Expand Down

0 comments on commit ce6ec09

Please sign in to comment.