From bc6146fc08089d6936b2335b4f0de8c171f2ad0d Mon Sep 17 00:00:00 2001 From: Brian Hatfield Date: Wed, 10 Apr 2013 23:48:22 -0400 Subject: [PATCH] Remove statsCached from console backend --- backends/console.js | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/backends/console.js b/backends/console.js index ca1eed4..2e5ffef 100644 --- a/backends/console.js +++ b/backends/console.js @@ -6,33 +6,17 @@ function ConsoleBackend(startupTime, config, emitter){ this.lastException = startupTime; this.config = config.console || {}; - this.statsCache = { - counters: {}, - timers: {} - }; - // attach emitter.on('flush', function(timestamp, metrics) { self.flush(timestamp, metrics); }); emitter.on('status', function(callback) { self.status(callback); }); }; ConsoleBackend.prototype.flush = function(timestamp, metrics) { - var self = this; console.log('Flushing stats at', new Date(timestamp * 1000).toString()); - // merge with previously sent values - Object.keys(self.statsCache).forEach(function(type) { - if(!metrics[type]) return; - Object.keys(metrics[type]).forEach(function(name) { - var value = metrics[type][name]; - self.statsCache[type][name] || (self.statsCache[type][name] = 0); - self.statsCache[type][name] += value; - }); - }); - var out = { - counters: this.statsCache.counters, - timers: this.statsCache.timers, + counters: metrics.counters, + timers: metrics.timers, gauges: metrics.gauges, timer_data: metrics.timer_data, counter_rates: metrics.counter_rates,