diff --git a/lib/new_relic/agent/configuration/default_source.rb b/lib/new_relic/agent/configuration/default_source.rb index 35dc2e1ff1..640a32b35b 100644 --- a/lib/new_relic/agent/configuration/default_source.rb +++ b/lib/new_relic/agent/configuration/default_source.rb @@ -1721,25 +1721,31 @@ def self.enforce_fallback(allowed_values: nil, fallback: nil) default: NewRelic::EMPTY_ARRAY, public: true, type: Array, + dynamic_name: true, allowed_from_server: false, - description: 'An array of strings that will collectively serve as an allowlist for filtering which Sidekiq ' + - 'job arguments get reported to New Relic. The capturing of any Sidekiq arguments requires that ' + - "'job.sidekiq.args.*' be added to the separate :'attributes.include' configuration option. Each " + - 'string in this array will be turned into a regular expression via `Regexp.new` to permit advanced ' + - 'matching. For job argument hashes, if either a key or value matches the pair will be included. All ' + - 'matching job argument array elements and job argument scalars will be included.' + description: <<~SIDEKIQ_ARGS_INCLUDE.chomp.tr("\n", ' ') + An array of strings that will collectively serve as an allowlist for filtering which Sidekiq + job arguments get reported to New Relic. The capturing of any Sidekiq arguments requires that + 'job.sidekiq.args.*' be added to the separate :'attributes.include' configuration option. Each + string in this array will be turned into a regular expression via `Regexp.new` to permit advanced + matching. For job argument hashes, if either a key or value matches the pair will be included. All + matching job argument array elements and job argument scalars will be included. + SIDEKIQ_ARGS_INCLUDE }, :'sidekiq.args.exclude' => { default: NewRelic::EMPTY_ARRAY, public: true, type: Array, + dynamic_name: true, allowed_from_server: false, - description: 'An array of strings that will collectively serve as a denylist for filtering which Sidekiq ' + - 'job arguments get reported to New Relic. The capturing of any Sidekiq arguments requires that ' + - "'job.sidekiq.args.*' be added to the separate :'attributes.include' configuration option. Each string " + - 'in this array will be turned into a regular expression via `Regexp.new` to permit advanced matching. ' + - 'For job argument hashes, if either a key or value matches the pair will be excluded. All matching job ' + - 'argument array elements and job argument scalars will be excluded.' + description: <<~SIDEKIQ_ARGS_EXCLUDE.chomp.tr("\n", ' ') + An array of strings that will collectively serve as a denylist for filtering which Sidekiq + job arguments get reported to New Relic. The capturing of any Sidekiq arguments requires that + 'job.sidekiq.args.*' be added to the separate :'attributes.include' configuration option. Each string + in this array will be turned into a regular expression via `Regexp.new` to permit advanced matching. + For job argument hashes, if either a key or value matches the pair will be excluded. All matching job + argument array elements and job argument scalars will be excluded. + SIDEKIQ_ARGS_EXCLUDE }, # Slow SQL :'slow_sql.enabled' => { diff --git a/test/helpers/config_scanning.rb b/test/helpers/config_scanning.rb index 10f20e90d9..83bff5eeee 100644 --- a/test/helpers/config_scanning.rb +++ b/test/helpers/config_scanning.rb @@ -15,11 +15,6 @@ module ConfigScanning EVENT_BUFFER_MACRO_PATTERN = /(capacity_key|enabled_key)\s+:(['"])?([a-z\._]+)\2?/ ASSIGNED_CONSTANT_PATTERN = /[A-Z]+\s*=\s*:(['"])?([a-z\._]+)\1?\s*/ - # These config settings shouldn't be worried about, possibly because they - # are only referenced via Ruby metaprogramming that won't work with this - # module's regex matching - IGNORED = %i[sidekiq.args.include sidekiq.args.exclude] - def scan_and_remove_used_entries(default_keys, non_test_files) non_test_files.each do |file| lines_in(file).each do |line| @@ -36,8 +31,6 @@ def scan_and_remove_used_entries(default_keys, non_test_files) default_keys.delete(key.delete("'").to_sym) end - IGNORED.each { |key| default_keys.delete(key) } - # Remove any config keys that are annotated with the 'dynamic_name' setting # This indicates that the names of these keys are constructed dynamically at # runtime, so we don't expect any explicit references to them in code.