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

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

Overview

Defines instrumentation for ActiveSupport cache writing of multiple keys

Instance Method Summary collapse

Instance Method Details

#write_multi(hash, options = nil) ⇒ Object



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb', line 229

def write_multi(hash, options = nil)
  payload = {
    action: Ext::RESOURCE_CACHE_MSET,
    keys: hash.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