Module: Datadog::Contrib::Rails::ActiveSupport
- Defined in:
- lib/ddtrace/contrib/rails/active_support.rb
Overview
Code used to create and handle ‘rails.cache’ spans.
Class Method Summary collapse
Class Method Details
.instrument ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ddtrace/contrib/rails/active_support.rb', line 9 def self.instrument # patch Rails core components Datadog::RailsCachePatcher.patch_cache_store() # subscribe when a cache read starts being processed ::ActiveSupport::Notifications.subscribe('start_cache_read.active_support') do |*args| start_trace_cache('GET', *args) end # subscribe when a cache fetch starts being processed ::ActiveSupport::Notifications.subscribe('start_cache_fetch.active_support') do |*args| start_trace_cache('GET', *args) end # subscribe when a cache write starts being processed ::ActiveSupport::Notifications.subscribe('start_cache_write.active_support') do |*args| start_trace_cache('SET', *args) end # subscribe when a cache delete starts being processed ::ActiveSupport::Notifications.subscribe('start_cache_delete.active_support') do |*args| start_trace_cache('DELETE', *args) end # subscribe when a cache read has been processed ::ActiveSupport::Notifications.subscribe('cache_read.active_support') do |*args| trace_cache('GET', *args) end # subscribe when a cache write has been processed ::ActiveSupport::Notifications.subscribe('cache_write.active_support') do |*args| trace_cache('SET', *args) end # subscribe when a cache delete has been processed ::ActiveSupport::Notifications.subscribe('cache_delete.active_support') do |*args| trace_cache('DELETE', *args) end end |