Skip to content

Commit

Permalink
Remove deprecated_disabled_configured
Browse files Browse the repository at this point in the history
We removed all the disabled_* configuration options that correlate
to an instrumentation.* configuration option in our last major version.
The disabled_* options
that remain will not be replaced with instrumentation.* options because
they do not use alias method chaining or module prepending or are not
related to instrumentation-related, but rather specific features.

Also, add alias for disable_active_job.
  • Loading branch information
kaylareopelle committed Jan 2, 2025
1 parent 4e1d3e8 commit a4055ab
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 25 deletions.
1 change: 1 addition & 0 deletions lib/new_relic/agent/configuration/default_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,7 @@ def self.notify
:default => false,
:public => true,
:type => Boolean,
:aliases => %i[disable_active_job],
:allowed_from_server => false,
:description => 'If `true`, disables Active Job instrumentation.'
},
Expand Down
19 changes: 1 addition & 18 deletions lib/new_relic/dependency_detection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,7 @@ def depends_on(&block)
end

def allowed_by_config?
!(disabled_configured? || deprecated_disabled_configured?)
end

# TODO: MAJOR VERSION
# will only return true if a disabled key is found and is truthy
def deprecated_disabled_configured?
return false if self.name.nil?

key = "disable_#{self.name}".to_sym
return false unless ::NewRelic::Agent.config[key] == true

::NewRelic::Agent.logger.debug("Not installing #{self.name} instrumentation because of configuration #{key}")
::NewRelic::Agent.logger.debug( \
"[DEPRECATED] configuration #{key} for #{self.name} will be removed in the next major release. " \
"Use `#{config_key}` with one of `#{VALID_CONFIG_VALUES.map(&:to_s).inspect}`"
)

return true
!disabled_configured?
end

def config_key
Expand Down
7 changes: 0 additions & 7 deletions test/new_relic/dependency_detection_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ def test_config_disabling_with_disabled
DependencyDetection.detect!

assert_predicate dd, :disabled_configured?
refute_predicate dd, :deprecated_disabled_configured?
refute_predicate dd, :allowed_by_config?
refute executed
end
Expand All @@ -165,7 +164,6 @@ def test_config_disabling_with_enabled
DependencyDetection.detect!

refute_predicate dd, :disabled_configured?
refute_predicate dd, :deprecated_disabled_configured?
assert_predicate dd, :allowed_by_config?
assert executed
end
Expand All @@ -185,7 +183,6 @@ def test_config_disabling_with_disable_testing
DependencyDetection.detect!

refute_predicate dd, :disabled_configured?
assert_predicate dd, :deprecated_disabled_configured?
refute_predicate dd, :allowed_by_config?
refute executed
end
Expand All @@ -204,7 +201,6 @@ def test_config_enabling_with_enabled
DependencyDetection.detect!

refute_predicate dd, :disabled_configured?
refute_predicate dd, :deprecated_disabled_configured?
assert executed
assert_predicate dd, :use_prepend?
end
Expand All @@ -220,7 +216,6 @@ def test_config_enabling_with_auto
DependencyDetection.detect!

refute_predicate dd, :disabled_configured?
refute_predicate dd, :deprecated_disabled_configured?
assert_predicate dd, :use_prepend?
end
end
Expand All @@ -235,7 +230,6 @@ def test_config_enabling_with_prepend
DependencyDetection.detect!

refute_predicate dd, :disabled_configured?
refute_predicate dd, :deprecated_disabled_configured?
assert_predicate dd, :use_prepend?
end
end
Expand All @@ -250,7 +244,6 @@ def test_config_enabling_with_chain
DependencyDetection.detect!

refute_predicate dd, :disabled_configured?
refute_predicate dd, :deprecated_disabled_configured?
refute_predicate dd, :use_prepend?
end
end
Expand Down

0 comments on commit a4055ab

Please sign in to comment.