Sha256: 7633bf00d6f2c8a2240f7a885ce2e7db6a5a4f4312287c9f9103a0f7d173062e

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 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 Processor module contains the instrumentation for the process_one method
        module Processor
          private

          def process_one
            if instrumentation_config[:trace_processor_process_one]
              attributes = {}
              attributes[SemanticConventions::Trace::PEER_SERVICE] = instrumentation_config[:peer_service] if instrumentation_config[:peer_service]
              tracer.in_span('Sidekiq::Processor#process_one', attributes: attributes) { super }
            else
              super
            end
          end

          def fetch
            if instrumentation_config[:trace_processor_process_one]
              super
            else
              OpenTelemetry::Common::Utilities.untraced { super }
            end
          end

          def tracer
            Sidekiq::Instrumentation.instance.tracer
          end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-sidekiq-0.25.7 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
opentelemetry-instrumentation-sidekiq-0.25.6 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
opentelemetry-instrumentation-sidekiq-0.25.5 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
opentelemetry-instrumentation-sidekiq-0.25.3 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
opentelemetry-instrumentation-sidekiq-0.25.2 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
opentelemetry-instrumentation-sidekiq-0.25.1 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
opentelemetry-instrumentation-sidekiq-0.25.0 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
opentelemetry-instrumentation-sidekiq-0.24.4 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb