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

Commit

Permalink
Exclude the source property from measurements sent to /measurements, …
Browse files Browse the repository at this point in the history
…as it it invalid to include in the posted request (#91)
  • Loading branch information
plmwong authored and bryanmikaelian committed May 18, 2017
1 parent f43ab84 commit fb09df9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit fb09df9

Please sign in to comment.