Sha256: f4a0952a0fa914f40c2e4f49328cd410899b5871b379c616e4cabae07a189940

Contents?: true

Size: 1017 Bytes

Versions: 4

Compression:

Stored size: 1017 Bytes

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['peer.service'] = instrumentation_config[:peer_service] if instrumentation_config[:peer_service]
              tracer.in_span('Sidekiq::Processor#process_one', attributes: attributes) { 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

4 entries across 4 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-sidekiq-0.23.0 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
opentelemetry-instrumentation-sidekiq-0.22.1 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
opentelemetry-instrumentation-sidekiq-0.22.0 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
opentelemetry-instrumentation-sidekiq-0.21.1 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb