Module: OpenTelemetry::Instrumentation::Que::Patches::Poller

Defined in:
lib/opentelemetry/instrumentation/que/patches/poller.rb

Overview

Instrumentation for the Que::Poller module

Instance Method Summary collapse

Instance Method Details

#poll(*args, **kwargs) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/opentelemetry/instrumentation/que/patches/poller.rb', line 13

def poll(*args, **kwargs)
  # Avoid tracing when should_poll? returns true. This is also used
  # in Poller#poll to decide if the actual poll should be executed or
  # not. Without this we would generate a lot of unnecessary spans.
  return unless should_poll?

  if Que::Instrumentation.instance.config[:trace_poller]
    Que::Instrumentation.instance.tracer.in_span('Que::Poller#poll') { super(*args, **kwargs) }
  else
    OpenTelemetry::Common::Utilities.untraced { super(*args, **kwargs) }
  end
end