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

Add test for timer percentiles #82

Merged
merged 1 commit into from
Apr 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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