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.rb` with 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.
39 40 41 |
# File 'lib/datadog/tracing/contrib/active_support/cache/patcher.rb', line 39 def cache_store_class(meth) [::ActiveSupport::Cache::Store] end |
.patch ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/datadog/tracing/contrib/active_support/cache/patcher.rb', line 22 def patch Events.subscribe! # 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
43 44 45 46 47 |
# File 'lib/datadog/tracing/contrib/active_support/cache/patcher.rb', line 43 def 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
18 19 20 |
# File 'lib/datadog/tracing/contrib/active_support/cache/patcher.rb', line 18 def target_version Integration.version end |