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

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

Overview

Defines instrumentation for ActiveSupport cache reading of multiple keys

Instance Method Summary collapse

Instance Method Details

#read_multi(*keys, &block) ⇒ Object



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb', line 135

def read_multi(*keys, &block)
  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