Don't allow histogram bins contain dots

This commit is contained in:
genus 2014-04-17 21:43:32 +04:00
Родитель 61c9607eee
Коммит 0ed6e39696
2 изменённых файлов: 2 добавлений и 2 удалений

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

@ -122,7 +122,7 @@ var process_metrics = function (metrics, flushInterval, ts, flushCallback) {
for (; i < count && (bins[bin_i] == 'inf' || values[i] < bins[bin_i]); i++) {
freq += 1;
}
bin_name = 'bin_' + bins[bin_i];
bin_name = 'bin_' + bins[bin_i].toString().replace('.', '_');
current_timer_data['histogram'][bin_name] = freq;
}

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

@ -192,7 +192,7 @@ module.exports = {
// only 'abc' should have a bin_inf; also check all its counts,
// and make sure it has no other bins
test.equal(1, timer_data['abc']['histogram']['bin_1']);
test.equal(0, timer_data['abc']['histogram']['bin_2.21']);
test.equal(0, timer_data['abc']['histogram']['bin_2_21']);
test.equal(4, timer_data['abc']['histogram']['bin_inf']);
test.equal(3, _.size(timer_data['abc']['histogram']));