module AppPerfRpm::Instruments::SequelDatabase

Public Instance Methods

run_with_trace(sql, options = ::Sequel::OPTS) click to toggle source
# 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