Sha256: 6745d0904e170c8d5c266816dce57c07263fe8fd2b12ae28e8c082af2e3d6875

Contents?: true

Size: 888 Bytes

Versions: 3

Compression:

Stored size: 888 Bytes

Contents

# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

module OpenTelemetry
  module Instrumentation
    module Que
      module Patches
        # Instrumentation for the Que::Poller module
        module Poller
          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 }
            else
              OpenTelemetry::Common::Utilities.untraced { super }
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-que-0.8.4 lib/opentelemetry/instrumentation/que/patches/poller.rb
opentelemetry-instrumentation-que-0.8.3 lib/opentelemetry/instrumentation/que/patches/poller.rb
opentelemetry-instrumentation-que-0.8.2 lib/opentelemetry/instrumentation/que/patches/poller.rb