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

Exclude the source property from measurements sent to /measurements, … #91

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions lib/librato.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ var flushStats = function libratoFlush(ts, metrics) {
gauges.push(legacyMeasure);
}
}

delete measure.source;
// Add the payload
measurements.push(measure);
// Post measurements and clear arrays if past batch size
Expand Down
4 changes: 3 additions & 1 deletion test/librato_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,14 @@ module.exports.legacy = {
config.librato.sourceRegex = /^(.*?)--/;
librato.init(null, config, this.emitter);

test.expect(8);
test.expect(9);
let metrics = {gauges: {'rails-application--my_gauge': 1}};
this.apiServer.post('/v1/measurements')
.reply(200, (uri, requestBody) => {
let measurement = requestBody.measurements[0];
test.ok(requestBody);
// no source when using the measurements api
test.equal(measurement.source, undefined);
test.equal(measurement.name, 'my_gauge');
test.equal(measurement.value, 1);
test.deepEqual(measurement.tags, {source: 'rails-application'});
Expand Down