Permalink
Browse files

Merge pull request #58 from pyr/master

Add delcounters and deltimers in the management server
  • Loading branch information...
2 parents c9d827a + ba2d084 commit 0cb65afdc1af2b7d4fe346a4ec75097f07fdb9ad @kastner kastner committed Feb 9, 2012
Showing with 19 additions and 2 deletions.
  1. +19 −2 stats.js
View
@@ -76,11 +76,12 @@ config.configFile(process.argv[2], function (config, oldConfig) {
stream.setEncoding('ascii');
stream.on('data', function(data) {
- var cmd = data.trim();
+ var cmdline = data.trim().split(" ");
+ var cmd = cmdline.shift();
switch(cmd) {
case "help":
- stream.write("Commands: stats, counters, timers, quit\n\n");
+ stream.write("Commands: stats, counters, timers, delcounters, deltimers, quit\n\n");
break;
case "stats":
@@ -116,6 +117,22 @@ config.configFile(process.argv[2], function (config, oldConfig) {
stream.write("END\n\n");
break;
+ case "delcounters":
+ for (index in cmdline) {
+ delete counters[cmdline[index]];
+ stream.write("deleted: " + cmdline[index] + "\n");
+ }
+ stream.write("END\n\n");
+ break;
+
+ case "deltimers":
+ for (index in cmdline) {
+ delete timers[cmdline[index]];
+ stream.write("deleted: " + cmdline[index] + "\n");
+ }
+ stream.write("END\n\n");
+ break;
+
case "quit":
stream.end();
break;

0 comments on commit 0cb65af

Please sign in to comment.