module BaselineRedRpm::Instruments::EmqueConsuming::Router

Public Instance Methods

route_with_trace(topic, type, message) click to toggle source
# File lib/baseline_red_rpm/instruments/emque_consuming.rb, line 7
def route_with_trace(topic, type, message)
  action = type.to_s.split(".").last

  span = ::BaselineRedRpm.tracer.start_span("#{topic}##{action}", tags: {
    "component" => "EmqueConsuming",
    "http.url" => "/#{topic}/#{action}",
    "peer.address" => Socket.gethostname
  })
  BaselineRedRpm::Utils.log_source_and_backtrace(span, :emque_consuming)

  route_without_trace(topic, type, message)
rescue Exception => e
  if span
    span.set_tag('error', true)
    span.log_error(e)
  end
  raise
ensure
  span.finish if span
end