Skip to content

Commit c9f7952

Browse files
committed
Swap to grouped cache_key settings
1 parent c909b1a commit c9f7952

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

lib/datadog/tracing/contrib/active_support/cache/events/cache.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ def on_start(span, event, _id, payload)
8181

8282
span.set_tag('EVENT', event)
8383

84-
set_cache_key(span, key, mapping[:multi_key]) if configuration[:cache_key_enabled]
84+
if Datadog.configuration.tracing[:active_support][:cache_key].enabled
85+
set_cache_key(span, key, mapping[:multi_key])
86+
end
8587
rescue StandardError => e
8688
Datadog.logger.error(e.message)
8789
Datadog::Core::Telemetry::Logger.report(e)

lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def trace(action, store, key: nil, multi_key: nil)
6060

6161
span.set_tag(Ext::TAG_CACHE_BACKEND, store) if store
6262

63-
set_cache_key(span, key, multi_key) if configuration[:cache_key_enabled]
63+
set_cache_key(span, key, multi_key) if Datadog.configuration.tracing[:active_support][:cache_key].enabled
6464

6565
yield
6666
end

lib/datadog/tracing/contrib/active_support/configuration/settings.rb

+8-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@ class Settings < Contrib::Configuration::Settings
4040
end
4141
end
4242

43-
option :cache_key_enabled do |o|
44-
o.type :bool
45-
o.default true
43+
# grouped "cache_key.*" settings
44+
settings :cache_key do
45+
# enable or disabling the inclusion of the cache_key in the span
46+
option :enabled do |o|
47+
# cache_key.enabled
48+
o.type :bool
49+
o.default true
50+
end
4651
end
4752
end
4853
end

0 commit comments

Comments
 (0)