Skip to content

Commit

Permalink
Merge pull request #26 from tmm1/patch-1
Browse files Browse the repository at this point in the history
Improve code clarity of counter processing loop
  • Loading branch information
kastner committed Feb 11, 2012
2 parents 5060bf4 + 193a73f commit 3cbd351
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions stats.js
Expand Up @@ -172,12 +172,13 @@ config.configFile(process.argv[2], function (config, oldConfig) {
var key;

for (key in counters) {
var value = counters[key] / (flushInterval / 1000);
var message = 'stats.' + key + ' ' + value + ' ' + ts + "\n";
message += 'stats_counts.' + key + ' ' + counters[key] + ' ' + ts + "\n";
statString += message;
counters[key] = 0;
var value = counters[key];
var valuePerSecond = value / (flushInterval / 1000); // calculate "per second" rate

statString += 'stats.' + key + ' ' + valuePerSecond + ' ' + ts + "\n";
statString += 'stats_counts.' + key + ' ' + value + ' ' + ts + "\n";

counters[key] = 0;
numStats += 1;
}

Expand Down

0 comments on commit 3cbd351

Please sign in to comment.