Sha256: ed2b34f2285205b89daceb913ba4de2711e1dadf1199fb8c5cca9f237a524035

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 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 Launcher module contains the instrumentation for the Sidekiq heartbeat
        module Launcher
          private

          def ❤ # rubocop:disable Naming/MethodName
            if instrumentation_config[:trace_launcher_heartbeat]
              attributes = {}
              attributes['peer.service'] = instrumentation_config[:peer_service] if instrumentation_config[:peer_service]
              tracer.in_span('Sidekiq::Launcher#heartbeat', 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

2 entries across 2 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-sidekiq-0.22.0 lib/opentelemetry/instrumentation/sidekiq/patches/launcher.rb
opentelemetry-instrumentation-sidekiq-0.21.1 lib/opentelemetry/instrumentation/sidekiq/patches/launcher.rb