Module: Datadog::Tracing::Contrib::ActiveSupport::Cache::Instrumentation::Fetch

Defined in:
lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb

Overview

Defines instrumentation for ActiveSupport cache fetching

Instance Method Summary collapse

Instance Method Details

#fetch(*args, &block) ⇒ Object



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb', line 158

def fetch(*args, &block)
  payload = {
    action: Ext::RESOURCE_CACHE_GET,
    key: args[0],
    tracing_context: {}
  }

  begin
    # process and catch cache exceptions
    Instrumentation.start_trace_cache(payload)
    super
  rescue Exception => e
    payload[:exception] = [e.class.name, e.message]
    payload[:exception_object] = e
    raise e
  end
ensure
  Instrumentation.finish_trace_cache(payload)
end