Sha256: e582aa2e05ccdaef709d4281bda06cd9e7a31604fd7b1729a77066918f1f1be3

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 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
              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.24.3 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
opentelemetry-instrumentation-sidekiq-0.24.2 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
opentelemetry-instrumentation-sidekiq-0.24.1 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
opentelemetry-instrumentation-sidekiq-0.24.0 lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb