module Datadog::Contrib::ActiveSupport::Cache::Instrumentation::Read

Defines instrumentation for ActiveSupport cache reading

Public Instance Methods

read(*args, &block) click to toggle source
Calls superclass method
# File lib/ddtrace/contrib/active_support/cache/instrumentation.rb, line 64
def read(*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