Module: Datadog::Tracing::Contrib::ActiveSupport::Cache::Patcher
- Includes:
- Patcher
- Defined in:
- lib/datadog/tracing/contrib/active_support/cache/patcher.rb
Overview
Patcher enables patching of 'active_support' module.
Class Method Summary collapse
-
.cache_store_class(meth) ⇒ Object
This method is overwritten by
datadog/tracing/contrib/active_support/cache/redis.rbwith more complex behavior. - .patch ⇒ Object
- .patch_legacy_cache_store ⇒ Object
- .target_version ⇒ Object
Methods included from Patcher
Class Method Details
.cache_store_class(meth) ⇒ Object
This method is overwritten by
datadog/tracing/contrib/active_support/cache/redis.rb
with more complex behavior.
41 42 43 |
# File 'lib/datadog/tracing/contrib/active_support/cache/patcher.rb', line 41 def self.cache_store_class(meth) [::ActiveSupport::Cache::Store] end |
.patch ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/datadog/tracing/contrib/active_support/cache/patcher.rb', line 20 def self.patch Events.subscribe! if Integration.version >= Gem::Version.new("8.0.0") ::ActiveSupport::Cache::Store.prepend(Cache::Instrumentation::PreserveOriginalKey) end # Backfill the `:store` key in the ActiveSupport event payload for older Rails. if Integration.version < Gem::Version.new("6.1.0") ::ActiveSupport::Cache::Store.prepend(Cache::Instrumentation::Store) end # DEV-3.0: Backwards compatibility code for the 2.x gem series. # DEV-3.0: See documentation at {Datadog::Tracing::Contrib::ActiveSupport::Cache::Instrumentation} # DEV-3.0: for the complete information about this backwards compatibility code. patch_legacy_cache_store end |
.patch_legacy_cache_store ⇒ Object
45 46 47 48 49 |
# File 'lib/datadog/tracing/contrib/active_support/cache/patcher.rb', line 45 def self.patch_legacy_cache_store cache_store_class(:read_multi).each { |clazz| clazz.prepend(Cache::Instrumentation::ReadMulti) } cache_store_class(:fetch).each { |clazz| clazz.prepend(Cache::Instrumentation::Fetch) } cache_store_class(:fetch_multi).each { |clazz| clazz.prepend(Cache::Instrumentation::FetchMulti) } end |
.target_version ⇒ Object
16 17 18 |
# File 'lib/datadog/tracing/contrib/active_support/cache/patcher.rb', line 16 def self.target_version Integration.version end |