Browse files

Change gauge modifications to unique type.

  • Loading branch information...
1 parent 0759f0b commit eb7d6503916540121261caa39402336a4f6a2aad James Socol committed May 11, 2012
Showing with 7 additions and 5 deletions.
  1. +5 −3 stats.js
  2. +2 −2 test/graphite_tests.js
View
8 stats.js
@@ -75,10 +75,12 @@ config.configFile(process.argv[2], function (config, oldConfig) {
}
timers[key].push(Number(fields[0] || 0));
} else if (fields[1].trim() == "g") {
- if (gauges[key] && fields[0].match(/^[-+]/)) {
- gauges[key] += Number(fields[0] || 0);
- } else {
+ gauges[key] = Number(fields[0] || 0);
+ } else if (fields[1].trim() == "gd") {
+ if (typeof gauges[key] == 'undefined') {
gauges[key] = Number(fields[0] || 0);
+ } else {
+ gauges[key] += Number(fields[0] || 0);
}
} else {
if (fields[2] && fields[2].match(/^@([\d\.]+)/)) {
View
4 test/graphite_tests.js
@@ -267,8 +267,8 @@ module.exports = {
var testresult = teststartvalue + Number(testdeltavalue);
var me = this;
this.acceptor.once('connection', function(c) {
- statsd_send('test_value:' + teststartvalue + '|g', me.sock, '127.0.0.1', 8125, function() {
- statsd_send('test_value:' + testdeltavalue + '|g', me.sock, '127.0.0.1', 8125, function() {
+ statsd_send('test_value:' + teststartvalue + '|gd', me.sock, '127.0.0.1', 8125, function() {
+ statsd_send('test_value:' + testdeltavalue + '|gd', me.sock, '127.0.0.1', 8125, function() {
collect_for(me.acceptor, me.myflush * 2, function(strings) {
test.ok(strings.length > 0, 'should receive some data');
var hashes = _.map(strings, function(x) {

0 comments on commit eb7d650

Please sign in to comment.