honeycombio / libhoney-rb

Ruby library for sending data to Honeycomb
Apache License 2.0
11 stars 30 forks source link

If writekey/dataset not configured, warn and fall back to no-op #25

Closed samstokes closed 6 years ago

samstokes commented 6 years ago

This makes Libhoney::Client validate the writekey and dataset at initialization time. If they are missing, it emits a warning to standard error and then falls back to a no-op mode where it will accept events and silently drop them.

I believe this is the behaviour you would want in pretty much any circumstance where you omitted the writekey but still initialized a Libhoney::Client, and improves on the current behaviour of waiting until event send time and then throwing an exception for every event, which is at best noisy and unhelpful.

Strictly this is backward incompatible, since it was technically possible for someone to leave writekey and dataset unspecified, and instead set them via a builder or on individual events. (This doesn't remove the latter capability, so it's still possible to send events to multiple teams or datasets using the same Libhoney::Client - you just have to pick a default writekey and dataset to initialize the Client.)