Class: Hermes::Tracers::Datadog

Inherits:
Object
  • Object
show all
Defined in:
lib/hermes/tracers/datadog.rb

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Datadog

Returns a new instance of Datadog.



9
10
11
# File 'lib/hermes/tracers/datadog.rb', line 9

def initialize(klass)
  @klass = klass
end

Instance Method Details

#handle(message) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/hermes/tracers/datadog.rb', line 13

def handle(message)
  tracer = ::Datadog.respond_to?(:tracer) ? ::Datadog.tracer : "Datadog::Tracing".safe_constantize

  tracer.trace(
    klass.class.name || klass.class.to_s,
    service: "hermes",
    span_type: "rabbitmq"
  ) do
    klass.process(message)
  end
end