Module: BaselineRedRpm::Instruments::EmqueConsuming::Router

Defined in:
lib/baseline_red_rpm/instruments/emque_consuming.rb

Instance Method Summary collapse

Instance Method Details

#route_with_trace(topic, type, message) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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