Module: Datadog::Contrib::ActiveSupport::Cache::Patcher

Includes:
Patcher
Defined in:
lib/ddtrace/contrib/active_support/cache/patcher.rb

Overview

Patcher enables patching of 'active_support' module.

Class Method Summary collapse

Methods included from Patcher

included

Class Method Details

.cache_store_class(meth) ⇒ Object



29
30
31
# File 'lib/ddtrace/contrib/active_support/cache/patcher.rb', line 29

def cache_store_class(meth)
  ::ActiveSupport::Cache::Store
end

.patchObject



19
20
21
22
23
24
25
26
27
# File 'lib/ddtrace/contrib/active_support/cache/patcher.rb', line 19

def patch
  patch_cache_store_read
  patch_cache_store_read_multi
  patch_cache_store_fetch
  patch_cache_store_fetch_multi
  patch_cache_store_write
  patch_cache_store_write_multi
  patch_cache_store_delete
end

.patch_cache_store_deleteObject



63
64
65
# File 'lib/ddtrace/contrib/active_support/cache/patcher.rb', line 63

def patch_cache_store_delete
  cache_store_class(:delete).prepend(Cache::Instrumentation::Delete)
end

.patch_cache_store_fetchObject



41
42
43
# File 'lib/ddtrace/contrib/active_support/cache/patcher.rb', line 41

def patch_cache_store_fetch
  cache_store_class(:fetch).prepend(Cache::Instrumentation::Fetch)
end

.patch_cache_store_fetch_multiObject



45
46
47
48
49
50
# File 'lib/ddtrace/contrib/active_support/cache/patcher.rb', line 45

def patch_cache_store_fetch_multi
  klass = cache_store_class(:fetch_multi)
  return unless klass.public_method_defined?(:fetch_multi)

  klass.prepend(Cache::Instrumentation::FetchMulti)
end

.patch_cache_store_readObject



33
34
35
# File 'lib/ddtrace/contrib/active_support/cache/patcher.rb', line 33

def patch_cache_store_read
  cache_store_class(:read).prepend(Cache::Instrumentation::Read)
end

.patch_cache_store_read_multiObject



37
38
39
# File 'lib/ddtrace/contrib/active_support/cache/patcher.rb', line 37

def patch_cache_store_read_multi
  cache_store_class(:read_multi).prepend(Cache::Instrumentation::ReadMulti)
end

.patch_cache_store_writeObject



52
53
54
# File 'lib/ddtrace/contrib/active_support/cache/patcher.rb', line 52

def patch_cache_store_write
  cache_store_class(:write).prepend(Cache::Instrumentation::Write)
end

.patch_cache_store_write_multiObject



56
57
58
59
60
61
# File 'lib/ddtrace/contrib/active_support/cache/patcher.rb', line 56

def patch_cache_store_write_multi
  klass = cache_store_class(:write_multi)
  return unless klass.public_method_defined?(:write_multi)

  klass.prepend(Cache::Instrumentation::WriteMulti)
end

.target_versionObject



15
16
17
# File 'lib/ddtrace/contrib/active_support/cache/patcher.rb', line 15

def target_version
  Integration.version
end