Similar to packets_received, but counts individual (good or bad) metrics lines
received
This commit is contained in:
Ben Burry 2014-10-13 17:18:16 +00:00
Родитель 206bdf0628
Коммит e3c237f217
7 изменённых файлов: 45 добавлений и 39 удалений

Просмотреть файл

@ -104,7 +104,9 @@ function flushMetrics() {
conf.deleteCounters = conf.deleteCounters || false;
for (var counter_key in metrics.counters) {
if (conf.deleteCounters) {
if ((counter_key.indexOf("packets_received") != -1) || (counter_key.indexOf("bad_lines_seen") != -1)) {
if ((counter_key.indexOf("packets_received") != -1) ||
(counter_key.indexOf("metrics_received") != -1) ||
(counter_key.indexOf("bad_lines_seen") != -1)) {
metrics.counters[counter_key] = 0;
} else {
delete(metrics.counters[counter_key]);
@ -174,11 +176,13 @@ config.configFile(process.argv[2], function (config) {
//setup the names for the stats stored in counters{}
bad_lines_seen = prefixStats + ".bad_lines_seen";
packets_received = prefixStats + ".packets_received";
metrics_received = prefixStats + ".metrics_received";
timestamp_lag_namespace = prefixStats + ".timestamp_lag";
//now set to zero so we can increment them
counters[bad_lines_seen] = 0;
counters[packets_received] = 0;
counters[metrics_received] = 0;
if (!serverLoaded) {
@ -201,6 +205,8 @@ config.configFile(process.argv[2], function (config) {
if (metrics[midx].length === 0) {
continue;
}
counters[metrics_received]++;
if (config.dumpMessages) {
l.log(metrics[midx].toString());
}

Просмотреть файл

@ -157,7 +157,7 @@ module.exports = {
return data;
});
test.ok(_.include(_.map(entries,function(x) { return _.keys(x)[0] }),'statsd.numStats'),'graphite output includes numStats');
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'statsd.numStats' })['statsd.numStats'],2);
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'statsd.numStats' })['statsd.numStats'],3);
test.done();
});
});
@ -180,9 +180,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'statsd.numStats';
return _.include(_.keys(post),mykey) && (post[mykey] == 3);
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
};
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 3');
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 4');
var bad_lines_seen_value_test = function(post){
var mykey = 'stats_counts.statsd.bad_lines_seen';
@ -213,9 +213,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'statsd.numStats';
return _.include(_.keys(post),mykey) && (post[mykey] == 3);
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
};
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 3');
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 4');
var testtimervalue_test = function(post){
var mykey = 'stats.timers.a_test_value.mean_90';
@ -246,9 +246,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'statsd.numStats';
return _.include(_.keys(post),mykey) && (post[mykey] == 3);
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
};
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 3');
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 4');
var testavgvalue_test = function(post){
var mykey = 'stats.a_test_value';

Просмотреть файл

@ -149,7 +149,7 @@ module.exports = {
return data;
});
test.ok(_.include(_.map(entries,function(x) { return _.keys(x)[0] }),'statsd.numStats'),'graphite output includes numStats');
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'statsd.numStats' })['statsd.numStats'],2);
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'statsd.numStats' })['statsd.numStats'],3);
test.done();
});
});
@ -172,9 +172,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'statsd.numStats';
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
return _.include(_.keys(post),mykey) && (post[mykey] == 5);
};
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 4');
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 5');
var testtimervalue_test = function(post){
var mykey = 'stats.timers.a_test_value.mean_90';
@ -205,9 +205,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'statsd.numStats';
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
return _.include(_.keys(post),mykey) && (post[mykey] == 5);
};
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 4');
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 5');
var testavgvalue_test = function(post){
var mykey = 'stats.a_test_value';

Просмотреть файл

@ -150,7 +150,7 @@ module.exports = {
return data;
});
test.ok(_.include(_.map(entries,function(x) { return _.keys(x)[0] }),'statsprefix.numStats'),'graphite output includes numStats');
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'statsprefix.numStats' })['statsprefix.numStats'],2);
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'statsprefix.numStats' })['statsprefix.numStats'],3);
test.done();
});
});
@ -173,9 +173,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'statsprefix.numStats';
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
return _.include(_.keys(post),mykey) && (post[mykey] == 5);
};
test.ok(_.any(hashes,numstat_test), 'statsprefix.numStats should be 4');
test.ok(_.any(hashes,numstat_test), 'statsprefix.numStats should be 5');
var testtimervalue_test = function(post){
var mykey = 'stats.timers.a_test_value.mean_90';
@ -206,9 +206,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'statsprefix.numStats';
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
return _.include(_.keys(post),mykey) && (post[mykey] == 5);
};
test.ok(_.any(hashes,numstat_test), 'statsprefix.numStats should be 4');
test.ok(_.any(hashes,numstat_test), 'statsprefix.numStats should be 5');
var testavgvalue_test = function(post){
var mykey = 'stats.a_test_value';

Просмотреть файл

@ -151,7 +151,7 @@ module.exports = {
return data;
});
test.ok(_.include(_.map(entries,function(x) { return _.keys(x)[0] }),'stats.statsd.numStats'),'graphite output includes numStats');
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'stats.statsd.numStats' })['stats.statsd.numStats'],2);
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'stats.statsd.numStats' })['stats.statsd.numStats'],3);
test.done();
});
});
@ -174,9 +174,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'stats.statsd.numStats';
return _.include(_.keys(post),mykey) && (post[mykey] == 3);
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
};
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 3');
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 4');
var bad_lines_seen_value_test = function(post){
var mykey = 'stats.counters.statsd.bad_lines_seen.count';
@ -207,9 +207,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'stats.statsd.numStats';
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
return _.include(_.keys(post),mykey) && (post[mykey] == 5);
};
test.ok(_.any(hashes,numstat_test), 'stats.statsd.numStats should be 4');
test.ok(_.any(hashes,numstat_test), 'stats.statsd.numStats should be 5');
var testtimervalue_test = function(post){
var mykey = 'stats.timers.a_test_value.mean_90';
@ -278,9 +278,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'stats.statsd.numStats';
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
return _.include(_.keys(post),mykey) && (post[mykey] == 5);
};
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 4');
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 5');
var testavgvalue_test = function(post){
var mykey = 'stats.counters.a_test_value.rate';

Просмотреть файл

@ -151,7 +151,7 @@ module.exports = {
return data;
});
test.ok(_.include(_.map(entries,function(x) { return _.keys(x)[0] }),'stats.statsprefix.numStats'),'graphite output includes numStats');
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'stats.statsprefix.numStats' })['stats.statsprefix.numStats'],2);
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'stats.statsprefix.numStats' })['stats.statsprefix.numStats'],3);
test.done();
});
});
@ -174,9 +174,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'stats.statsprefix.numStats';
return _.include(_.keys(post),mykey) && (post[mykey] == 3);
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
};
test.ok(_.any(hashes,numstat_test), 'statsprefix.numStats should be 3');
test.ok(_.any(hashes,numstat_test), 'statsprefix.numStats should be 4');
var bad_lines_seen_value_test = function(post){
var mykey = 'stats.counters.statsprefix.bad_lines_seen.count';
@ -207,9 +207,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'stats.statsprefix.numStats';
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
return _.include(_.keys(post),mykey) && (post[mykey] == 5);
};
test.ok(_.any(hashes,numstat_test), 'stats.statsprefix.numStats should be 4');
test.ok(_.any(hashes,numstat_test), 'stats.statsprefix.numStats should be 5');
var testtimervalue_test = function(post){
var mykey = 'stats.timers.a_test_value.mean_90';
@ -240,9 +240,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'stats.statsprefix.numStats';
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
return _.include(_.keys(post),mykey) && (post[mykey] == 5);
};
test.ok(_.any(hashes,numstat_test), 'statsprefix.numStats should be 4');
test.ok(_.any(hashes,numstat_test), 'statsprefix.numStats should be 5');
var testavgvalue_test = function(post){
var mykey = 'stats.counters.a_test_value.rate';

Просмотреть файл

@ -153,7 +153,7 @@ module.exports = {
});
test.ok(_.include(_.map(entries,function(x) { return _.keys(x)[0] }),'stats.statsd.numStats.statssuffix'),'graphite output includes numStats');
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'stats.statsd.numStats.statssuffix' })['stats.statsd.numStats.statssuffix'],2);
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'stats.statsd.numStats.statssuffix' })['stats.statsd.numStats.statssuffix'],3);
test.done();
});
});
@ -176,9 +176,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'stats.statsd.numStats.statssuffix';
return _.include(_.keys(post),mykey) && (post[mykey] == 3);
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
};
test.ok(_.any(hashes,numstat_test), 'numStats.statssuffix should be 3');
test.ok(_.any(hashes,numstat_test), 'numStats.statssuffix should be 4');
var bad_lines_seen_value_test = function(post){
var mykey = 'stats.counters.statsd.bad_lines_seen.count.statssuffix';
@ -209,9 +209,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'stats.statsd.numStats.statssuffix';
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
return _.include(_.keys(post),mykey) && (post[mykey] == 5);
};
test.ok(_.any(hashes,numstat_test), 'stats.statsd.numStats.statssuffix should be 4');
test.ok(_.any(hashes,numstat_test), 'stats.statsd.numStats.statssuffix should be 5');
var testtimervalue_test = function(post){
var mykey = 'stats.timers.a_test_value.mean_90.statssuffix';
@ -242,9 +242,9 @@ module.exports = {
});
var numstat_test = function(post){
var mykey = 'stats.statsd.numStats.statssuffix';
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
return _.include(_.keys(post),mykey) && (post[mykey] == 5);
};
test.ok(_.any(hashes,numstat_test), 'numStats.statssuffix should be 4');
test.ok(_.any(hashes,numstat_test), 'numStats.statssuffix should be 5');
var testavgvalue_test = function(post){
var mykey = 'stats.counters.a_test_value.rate.statssuffix';