Module: Datadog::Contrib::ActiveSupport::Cache::Instrumentation::Delete

Defined in:
lib/ddtrace/contrib/active_support/cache/instrumentation.rb

Overview

Defines instrumentation for ActiveSupport cache deleting

Instance Method Summary collapse

Instance Method Details

#delete(*args, &block) ⇒ Object



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/ddtrace/contrib/active_support/cache/instrumentation.rb', line 235

def delete(*args, &block)
  payload = {
    action: Ext::RESOURCE_CACHE_DELETE,
    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