librato / statsd-librato-backend

A StatsD backend that sends metrics to Librato Metrics
MIT License
76 stars 34 forks source link

Logging whole response in debug mode #101

Closed mathieucarbou closed 7 years ago

mathieucarbou commented 7 years ago

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.

mathieucarbou commented 7 years ago

@bryanmikaelian : yes it's chatty, and I think this is what you want when in debug mode: this is the only way I have as a user of this plugin to make sure Librato receives the response and processes it and then to see its answer. Hence the (if(logAll))

bryanmikaelian commented 7 years ago

Cool. Makes sense. I'll see if anyone else on the team has any thoughts and then we can merge / release.

mheffner commented 7 years ago

If we are logging the request, seems like logging all responses is equally verbose. 👍

bryanmikaelian commented 7 years ago

👍

Thanks for the contribution @mathieucarbou! I'll get this merged and published to npm today.