зеркало из https://github.com/microsoft/statsd.git
bugfix: make sure histogram metric path is correct
also slight optimisation in the metric setting loop for timers
This commit is contained in:
Родитель
338fbd5d47
Коммит
7447b55724
|
@ -99,10 +99,17 @@ var flush_stats = function graphite_flush(ts, metrics) {
|
|||
|
||||
for (key in timer_data) {
|
||||
if (Object.keys(timer_data).length > 0) {
|
||||
var namespace = timerNamespace.concat(key);
|
||||
var the_key = namespace.join(".");
|
||||
for (timer_data_key in timer_data[key]) {
|
||||
var namespace = timerNamespace.concat(key);
|
||||
var the_key = namespace.join(".");
|
||||
statString += the_key + '.' + timer_data_key + ' ' + timer_data[key][timer_data_key] + ' ' + ts + "\n";
|
||||
if (typeof(timer_data_key) === 'string') {
|
||||
statString += the_key + '.' + timer_data_key + ' ' + timer_data[key][timer_data_key] + ' ' + ts + "\n";
|
||||
} else {
|
||||
for (timer_data_sub_key in timer_data[key][timer_data_key]) {
|
||||
statString += the_key + '.' + timer_data_key + '.' + timer_data_sub_key + ' ' +
|
||||
timer_data[key][timer_data_key][timer_data_sub_key] + ' ' + ts + "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
numStats += 1;
|
||||
|
|
|
@ -76,6 +76,7 @@ module.exports = {
|
|||
, batch: 200 \n\
|
||||
, flushInterval: " + this.myflush + " \n\
|
||||
, percentThreshold: 90\n\
|
||||
, timer: {histogram: [ { metric: \"a_test_value\", bins: [10] } ]}\n\
|
||||
, port: 8125\n\
|
||||
, dumpMessages: false \n\
|
||||
, debug: false\n\
|
||||
|
@ -214,6 +215,7 @@ module.exports = {
|
|||
var mykey = 'stats.timers.a_test_value.mean_90';
|
||||
return _.include(_.keys(post),mykey) && (post[mykey] == testvalue);
|
||||
};
|
||||
//TODO: test here that one of the histogram datapoints is also correct
|
||||
test.ok(_.any(hashes,testtimervalue_test), 'stats.timers.a_test_value.mean should be ' + testvalue);
|
||||
|
||||
test.done();
|
||||
|
|
Загрузка…
Ссылка в новой задаче