Module: AppPerfRpm::Instruments::SequelDatabase

Includes:
Sequel
Defined in:
lib/app_perf_rpm/instruments/sequel.rb

Instance Method Summary collapse

Methods included from Sequel

#parse_opts, #sanitize_sql

Instance Method Details

#run_with_trace(sql, options = ::Sequel::OPTS) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/app_perf_rpm/instruments/sequel.rb', line 40

def run_with_trace(sql, options = ::Sequel::OPTS)
  if ::AppPerfRpm::Tracer.tracing?
    span = ::AppPerfRpm.tracer.start_span("sequel", tags: parse_opts(sql, options))
    span.set_tag "component", "Sequel"
    span.set_tag "span.kind", "client"
    AppPerfRpm::Utils.log_source_and_backtrace(span, :sequel)
  end

  run_without_trace(sql, options)
rescue Exception => e
  if span
    span.set_tag('error', true)
    span.log_error(e)
  end
  raise
ensure
  span.finish if span
end