Sha256: db46dd07480ddd333b47c3c8b56afd87a0b6e9c6004d4c708270f44610c2b91a

Contents?: true

Size: 1.23 KB

Versions: 21

Compression:

Stored size: 1.23 KB

Contents

require 'ddtrace/contrib/patcher'
require 'ddtrace/contrib/active_support/cache/instrumentation'

module Datadog
  module Contrib
    module ActiveSupport
      module Cache
        # Patcher enables patching of 'active_support' module.
        module Patcher
          include Contrib::Patcher

          module_function

          def target_version
            Integration.version
          end

          def patch
            patch_cache_store_read
            patch_cache_store_fetch
            patch_cache_store_write
            patch_cache_store_delete
          end

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

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

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

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

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

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
ddtrace-0.42.0 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.41.0 lib/ddtrace/contrib/active_support/cache/patcher.rb
ls-trace-0.2.0 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.40.0 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.39.0 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.38.0 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.37.0 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.36.0 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.35.2 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.35.1 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.35.0 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.34.2 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.34.1 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.34.0 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.33.1 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.33.0 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.32.0 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.31.1 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.31.0 lib/ddtrace/contrib/active_support/cache/patcher.rb
ddtrace-0.30.1 lib/ddtrace/contrib/active_support/cache/patcher.rb