Optionally omit stats_counts metrics

Adds the 'flush_counts' config. Defaults to true, so existing configs
aren't affected.
This commit is contained in:
Aaron Suggs 2012-08-23 10:59:01 -04:00
Родитель 4bd7597068
Коммит 393eb8f8cd
2 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -19,6 +19,7 @@ var debug;
var flushInterval;
var graphiteHost;
var graphitePort;
var flush_counts;
var graphiteStats = {};
@ -66,7 +67,10 @@ var flush_stats = function graphite_flush(ts, metrics) {
var valuePerSecond = value / (flushInterval / 1000); // calculate "per second" rate
statString += 'stats.' + key + ' ' + valuePerSecond + ' ' + ts + "\n";
statString += 'stats_counts.' + key + ' ' + value + ' ' + ts + "\n";
if (flush_counts) {
statString += 'stats_counts.' + key + ' ' + value + ' ' + ts + "\n";
}
numStats += 1;
}
@ -156,6 +160,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);

Просмотреть файл

@ -30,6 +30,8 @@ Optional Variables:
percentThreshold: for time information, calculate the Nth percentile(s)
(can be a single value or list of floating-point 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]