Skip to content

Commit

Permalink
Fixed re-setting stats.
Browse files Browse the repository at this point in the history
Added commands to view+delete raws and averages (untested)
  • Loading branch information
Peter C. Norton authored and jeff-minard-ck committed Jun 15, 2012
1 parent a9f05bc commit df0f344
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions stats.js
Expand Up @@ -37,6 +37,8 @@ function flushMetrics() {


var metrics_hash = { var metrics_hash = {
counters: counters, counters: counters,
raws: raws,
averages: averages,
gauges: gauges, gauges: gauges,
timers: timers, timers: timers,
pctThreshold: pctThreshold pctThreshold: pctThreshold
Expand All @@ -53,6 +55,8 @@ function flushMetrics() {
for (key in metrics.timers) { for (key in metrics.timers) {
metrics.timers[key] = []; metrics.timers[key] = [];
} }
// Clear the raws
metrics.raws.length = 0
}); });


// Flush metrics to each backend. // Flush metrics to each backend.
Expand Down Expand Up @@ -207,6 +211,16 @@ config.configFile(process.argv[2], function (config, oldConfig) {
stream.write("END\n\n"); stream.write("END\n\n");
break; break;


case "raws":
stream.write(util.inspect(raws) + "\n");
stream.write("END\n\n");
break;

case "averages":
stream.write(util.inspect(averages) + "\n");
stream.write("END\n\n");
break;

case "gauges": case "gauges":
stream.write(util.inspect(gauges) + "\n"); stream.write(util.inspect(gauges) + "\n");
stream.write("END\n\n"); stream.write("END\n\n");
Expand All @@ -228,6 +242,22 @@ config.configFile(process.argv[2], function (config, oldConfig) {
stream.write("END\n\n"); stream.write("END\n\n");
break; break;


case "delraws":
for (index in cmdline) {
delete raws[cmdline[index]];
stream.write("deleted: " + cmdline[index] + "\n");
}
stream.write("END\n\n");
break;

case "delaverages":
for (index in cmdline) {
delete averages[cmdline[index]];
stream.write("deleted: " + cmdline[index] + "\n");
}
stream.write("END\n\n");
break;

case "delgauges": case "delgauges":
for (index in cmdline) { for (index in cmdline) {
delete gauges[cmdline[index]]; delete gauges[cmdline[index]];
Expand Down

0 comments on commit df0f344

Please sign in to comment.