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

Commit

Permalink
Logging whole response in debug mode (#101)
Browse files Browse the repository at this point in the history
Because some other errors might happen than the one handled (stoplist). Example, if the tag values have an invalid format, the response is something like:

`{"measurements":{"summary":{"total":174,"accepted":78,"failed":96,"filtered":0}},"errors":[{"param":"tag_value","value":"41454@127_0_0_1","reason":"Invalid format"}]}`

So it would be nice to log the whole response in debug mode to avoid discarding important failures.
  • Loading branch information
mathieucarbou authored and bryanmikaelian committed Oct 16, 2017
1 parent bee1f4b commit 53d379c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/librato.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ var postPayload = function(options, proto, payload, retry) {
}
var req = proto.request(options, function(res) {
res.on('data', function(d) {
if (logAll) {
util.log('Response: ' + d);
}
// Retry 5xx codes
if (Math.floor(res.statusCode / 100) == 5) {
var errdata = 'HTTP ' + res.statusCode + ': ' + d;
Expand Down

0 comments on commit 53d379c

Please sign in to comment.