Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #82 from librato/chore/timer-suffix-test
Browse files Browse the repository at this point in the history
Add test for timer percentiles
  • Loading branch information
bryanmikaelian authored Apr 21, 2017
2 parents 46b9673 + 66b5374 commit 9da806e
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/librato_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,40 @@ module.exports = {
this.emitter.emit('flush', 123, metrics);
},

testTimersPercentiles: function(test) {
test.expect(14);
let metrics = {
timers: {
'my_timer#tag=foo': [10],
},
timer_data: {'my_timer#tag=foo': null},
pctThreshold: {99: 99},
};
this.apiServer.post('/v1/measurements')
.reply(200, (uri, requestBody) => {
let hundredth = requestBody.measurements[0];
test.ok(hundredth);
test.equal(hundredth.name, 'my_timer');
test.equal(hundredth.value, undefined);
test.equal(hundredth.min, 10);
test.equal(hundredth.max, 10);
test.equal(hundredth.sum, 10);
test.deepEqual(hundredth.tags, {tag: 'foo'});

let measurement = requestBody.measurements[1];
test.ok(measurement);
test.equal(measurement.name, 'my_timer.99');
test.equal(measurement.value, undefined);
test.equal(measurement.min, 10);
test.equal(measurement.max, 10);
test.equal(measurement.sum, 10);
test.deepEqual(measurement.tags, {tag: 'foo'});
test.done();
});

this.emitter.emit('flush', 123, metrics);
},

testIgnoreBrokenMetrics: function(test) {
test.expect(3);
let metrics = {
Expand Down

0 comments on commit 9da806e

Please sign in to comment.