Explicitly configure libhoney null client when no api key detected (#14154)

This configures the fallback behavior we're relying on in self-hosted
forems, and disables a warning that the fallback is happening.
This commit is contained in:
Daniel Uber 2021-07-08 09:16:02 -05:00 committed by GitHub
parent d625ef9f70
commit e99e803867
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,12 @@ else
Honeycomb.configure do |config|
config.write_key = honeycomb_api_key.presence
# libhoney client will automatically fall back to using a null transmission
# when no write key is provided, but it will log a warning (visible in a few places)
# explicitly override the client to disable the warning
config.client = Libhoney::NullClient.new unless config.write_key
if ENV["HONEYCOMB_DISABLE_AUTOCONFIGURE"]
config.dataset = "background-work"
else