зеркало из https://github.com/microsoft/statsd.git
Add tests to verify percentile counts.
This commit is contained in:
Родитель
750ce576a3
Коммит
cd47d32c53
|
@ -90,12 +90,13 @@ module.exports = {
|
|||
test.done();
|
||||
},
|
||||
timers_single_time_multiple_percentiles: function(test) {
|
||||
test.expect(6);
|
||||
test.expect(7);
|
||||
this.metrics.timers['a'] = [100];
|
||||
this.metrics.timer_counters['a'] = 1;
|
||||
this.metrics.pctThreshold = [90, 80];
|
||||
pm.process_metrics(this.metrics, 100, this.time_stamp, function(){});
|
||||
timer_data = this.metrics.timer_data['a'];
|
||||
test.equal(1, timer_data.count_90);
|
||||
test.equal(100, timer_data.mean_90);
|
||||
test.equal(100, timer_data.upper_90);
|
||||
test.equal(100, timer_data.sum_90);
|
||||
|
@ -105,27 +106,32 @@ module.exports = {
|
|||
test.done();
|
||||
},
|
||||
timers_multiple_times_single_percentiles: function(test) {
|
||||
test.expect(3);
|
||||
test.expect(4);
|
||||
this.metrics.timers['a'] = [100, 200, 300];
|
||||
this.metrics.timer_counters['a'] = 3;
|
||||
this.metrics.pctThreshold = [90];
|
||||
pm.process_metrics(this.metrics, 100, this.time_stamp, function(){});
|
||||
timer_data = this.metrics.timer_data['a'];
|
||||
test.equal(3, timer_data.count_90);
|
||||
test.equal(200, timer_data.mean_90);
|
||||
test.equal(300, timer_data.upper_90);
|
||||
test.equal(600, timer_data.sum_90);
|
||||
test.done();
|
||||
},
|
||||
timers_multiple_times_multiple_percentiles: function(test) {
|
||||
test.expect(6);
|
||||
test.expect(9);
|
||||
this.metrics.timers['a'] = [100, 200, 300];
|
||||
this.metrics.timer_counters['a'] = 3;
|
||||
this.metrics.pctThreshold = [90, 80];
|
||||
pm.process_metrics(this.metrics, 100, this.time_stamp, function(){});
|
||||
timer_data = this.metrics.timer_data['a'];
|
||||
test.equal(3, timer_data.count);
|
||||
test.equal(3, timer_data.count_90);
|
||||
test.equal(200, timer_data.mean_90);
|
||||
test.equal(300, timer_data.upper_90);
|
||||
test.equal(600, timer_data.sum_90);
|
||||
|
||||
test.equal(2, timer_data.count_80);
|
||||
test.equal(150, timer_data.mean_80);
|
||||
test.equal(200, timer_data.upper_80);
|
||||
test.equal(300, timer_data.sum_80);
|
||||
|
|
Загрузка…
Ссылка в новой задаче