Skip to content

Commit

Permalink
Merge pull request statsd#418 from genuss/hist_dots
Browse files Browse the repository at this point in the history
Don't allow histogram bins contain dots
  • Loading branch information
mrtazz committed May 15, 2014
2 parents 67d51c4 + 0ed6e39 commit 7c29c5b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/process_metrics.js
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion test/process_metrics_tests.js
Expand Up @@ -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']));

Expand Down

0 comments on commit 7c29c5b

Please sign in to comment.