Skip to content

Commit a273571

Browse files
Actually allow disabling Datadog (#5493)
It is impossible to disable Datadog because we don't coerce the environment variable that toggles Datadog to boolean. This change coerces the value into a Boolean. This bug has led to a lot of log noise in environments where Datadog is disabled because of the server attempting to connect to a Datadog instances that do not exist. "false" is true. And `nil` is short-circuited by the OR operator.
1 parent d9fb1bd commit a273571

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

config/initializers/00_datadog.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Allow running via an ENV var (for development usage, for example) ...otherwise
66
# exclude some envs by default
7-
DATADOG_ENABLED = ENV["DATADOG_ENABLED"] || !(Rails.env.development? || Rails.env.test? || Rails.env.profiling? || SimpleServer.env.review? || SimpleServer.env.android_review?)
7+
DATADOG_ENABLED = ActiveModel::Type::Boolean.new.cast(ENV["DATADOG_ENABLED"]) || !(Rails.env.development? || Rails.env.test? || Rails.env.profiling? || SimpleServer.env.review? || SimpleServer.env.android_review?)
88

99
Datadog.configure do |c|
1010
c.tracing.enabled = DATADOG_ENABLED

0 commit comments

Comments
 (0)