Sha256: 460c997593df3370225449ab537af4a1f503dd4623817013202cfb9b43d6267e

Contents?: true

Size: 922 Bytes

Versions: 12

Compression:

Stored size: 922 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(*args, **kwargs) }
            else
              OpenTelemetry::Common::Utilities.untraced { super(*args, **kwargs) }
            end
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-que-0.8.1 lib/opentelemetry/instrumentation/que/patches/poller.rb
opentelemetry-instrumentation-que-0.8.0 lib/opentelemetry/instrumentation/que/patches/poller.rb
opentelemetry-instrumentation-que-0.7.1 lib/opentelemetry/instrumentation/que/patches/poller.rb
opentelemetry-instrumentation-que-0.7.0 lib/opentelemetry/instrumentation/que/patches/poller.rb
opentelemetry-instrumentation-que-0.6.2 lib/opentelemetry/instrumentation/que/patches/poller.rb
opentelemetry-instrumentation-que-0.6.1 lib/opentelemetry/instrumentation/que/patches/poller.rb
opentelemetry-instrumentation-que-0.6.0 lib/opentelemetry/instrumentation/que/patches/poller.rb
opentelemetry-instrumentation-que-0.5.1 lib/opentelemetry/instrumentation/que/patches/poller.rb
opentelemetry-instrumentation-que-0.5.0 lib/opentelemetry/instrumentation/que/patches/poller.rb
opentelemetry-instrumentation-que-0.4.0 lib/opentelemetry/instrumentation/que/patches/poller.rb
opentelemetry-instrumentation-que-0.3.0 lib/opentelemetry/instrumentation/que/patches/poller.rb
opentelemetry-instrumentation-que-0.2.0 lib/opentelemetry/instrumentation/que/patches/poller.rb