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

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

Overview

Defines instrumentation for ActiveSupport cache writing

Instance Method Summary collapse

Instance Method Details

#write(*args, &block) ⇒ Object



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb', line 206

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