Sha256: 55503e0a39f8541ca6b4445bfa8e323c0376a704147a1cd25af7ac187783228a

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Instrumentation
    module Sidekiq
      module Patches
        # The Poller module contains instrumentation for the enqueue and wait methods
        module Poller
          def enqueue
            if config[:trace_poller_enqueue]
              tracer.in_span('Sidekiq::Scheduled::Poller#enqueue') { super }
            else
              OpenTelemetry::Common::Utilities.untraced { super }
            end
          end

          private

          def wait
            if config[:trace_poller_wait]
              tracer.in_span('Sidekiq::Scheduled::Poller#wait') { super }
            else
              OpenTelemetry::Common::Utilities.untraced { super }
            end
          end

          def tracer
            Sidekiq::Instrumentation.instance.tracer
          end

          def config
            Sidekiq::Instrumentation.instance.config
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-sidekiq-0.16.0 lib/opentelemetry/instrumentation/sidekiq/patches/poller.rb
opentelemetry-instrumentation-sidekiq-0.15.0 lib/opentelemetry/instrumentation/sidekiq/patches/poller.rb
opentelemetry-instrumentation-sidekiq-0.14.0 lib/opentelemetry/instrumentation/sidekiq/patches/poller.rb
opentelemetry-instrumentation-sidekiq-0.13.0 lib/opentelemetry/instrumentation/sidekiq/patches/poller.rb