From e99e803867e6650ce85b4f4720892672385a862d Mon Sep 17 00:00:00 2001 From: Daniel Uber Date: Thu, 8 Jul 2021 09:16:02 -0500 Subject: [PATCH] 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. --- config/initializers/honeycomb.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/initializers/honeycomb.rb b/config/initializers/honeycomb.rb index d45960518..2f3f1ca92 100644 --- a/config/initializers/honeycomb.rb +++ b/config/initializers/honeycomb.rb @@ -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