Module: AppPerfRpm::Instruments::SequelDataset

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

#execute_with_trace(sql, options = ::Sequel::OPTS, &block) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/app_perf_rpm/instruments/sequel.rb', line 63

def execute_with_trace(sql, options = ::Sequel::OPTS, &block)
  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

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