module Datadog::Contrib::ActiveSupport::Cache::Instrumentation::FetchMulti

Defines instrumentation for ActiveSupport cache fetching of multiple keys

Public Instance Methods

fetch_multi(*args, &block) click to toggle source
Calls superclass method
# File lib/ddtrace/contrib/active_support/cache/instrumentation.rb, line 164
def fetch_multi(*args, &block)
  # extract options hash
  keys = args[-1].instance_of?(Hash) ? args[0..-2] : args
  payload = {
    action: Ext::RESOURCE_CACHE_MGET,
    keys: keys,
    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_multi(payload)
end