Sha256: f3535c99c6f5ab821eac9c6ef0ff0b10117b0a1545e9b3ecf9270e650e610105

Contents?: true

Size: 976 Bytes

Versions: 3

Compression:

Stored size: 976 Bytes

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Instrumentation
    module Resque
      # The Instrumentation class contains logic to detect and install the Resque instrumentation
      class Instrumentation < OpenTelemetry::Instrumentation::Base
        install do |_config|
          require_dependencies
          patch
        end

        present do
          defined?(::Resque)
        end

        option :span_naming,       default: :queue, validate: %I[job_class queue]
        option :propagation_style, default: :link,  validate: %i[link child none]

        private

        def patch
          ::Resque.prepend(Patches::ResqueModule)
          ::Resque::Job.prepend(Patches::ResqueJob)
        end

        def require_dependencies
          require_relative 'patches/resque_module'
          require_relative 'patches/resque_job'
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-resque-0.3.1 lib/opentelemetry/instrumentation/resque/instrumentation.rb
opentelemetry-instrumentation-resque-0.3.0 lib/opentelemetry/instrumentation/resque/instrumentation.rb
opentelemetry-instrumentation-resque-0.2.0 lib/opentelemetry/instrumentation/resque/instrumentation.rb