From bbff0f757e2ceb8a61968e0d6f1da5698a33651e Mon Sep 17 00:00:00 2001 From: Molly Struve Date: Mon, 11 May 2020 11:59:18 -0500 Subject: [PATCH] [deploy] dont configure Honeycomb if its disabled (#6618) --- config/initializers/honeycomb.rb | 40 ++++++++++++++++++-------------- datadog/prerun.sh | 3 ++- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/config/initializers/honeycomb.rb b/config/initializers/honeycomb.rb index fbf945bac..59869dace 100644 --- a/config/initializers/honeycomb.rb +++ b/config/initializers/honeycomb.rb @@ -8,25 +8,29 @@ else # Honeycomb automatic Rails integration Honeycomb.configure do |config| config.write_key = honeycomb_api_key - config.dataset = "rails" - config.notification_events = %w[ - sql.active_record - render_template.action_view - render_partial.action_view - render_collection.action_view - process_action.action_controller - send_file.action_controller - send_data.action_controller - deliver.action_mailer - ].freeze + if ENV["HONEYCOMB_DISABLE_AUTOCONFIGURE"] + config.dataset = "background-work" + else + config.dataset = "rails" + config.notification_events = %w[ + sql.active_record + render_template.action_view + render_partial.action_view + render_collection.action_view + process_action.action_controller + send_file.action_controller + send_data.action_controller + deliver.action_mailer + ].freeze - # Scrub unused data to save space in Honeycomb - config.presend_hook do |fields| - if fields.key?("redis.command") - fields["redis.command"].slice!(0, 300) - elsif fields.key?("sql.active_record.binds") - fields.delete("sql.active_record.binds") - fields.delete("sql.active_record.datadog_span") + # Scrub unused data to save space in Honeycomb + config.presend_hook do |fields| + if fields.key?("redis.command") + fields["redis.command"].slice!(0, 300) + elsif fields.key?("sql.active_record.binds") + fields.delete("sql.active_record.binds") + fields.delete("sql.active_record.datadog_span") + end end end end diff --git a/datadog/prerun.sh b/datadog/prerun.sh index 8444079f4..6a724a3e9 100644 --- a/datadog/prerun.sh +++ b/datadog/prerun.sh @@ -6,5 +6,6 @@ if [ "$DYNOTYPE" == "scheduler" ] || [ "$DYNOTYPE" == "run" ]; then # Disable Automatic Beeline integrations to prevent unnecessary # data from being tracked in Honeycomb # more info here: https://docs.honeycomb.io/getting-data-in/ruby/beeline/#using-env-variables-to-control-framework-integrations - HONEYCOMB_DISABLE_AUTOCONFIGURE="true" + export HONEYCOMB_DISABLE_AUTOCONFIGURE="true" + export HONEYCOMB_INTEGRATIONS=rails,rake,active_support fi