Sha256: a06cfeb505f52aa829d1a7f5c34b7f229c6c0dcee2825fd098a01b77bb784a63

Contents?: true

Size: 970 Bytes

Versions: 10

Compression:

Stored size: 970 Bytes

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Instrumentation
    module DelayedJob
      # Instrumentation class that detects and installs the DelayedJob instrumentation
      class Instrumentation < OpenTelemetry::Instrumentation::Base
        MINIMUM_VERSION = Gem::Version.new('4.1')

        install do |_config|
          require_dependencies
          register_tracer_plugin
        end

        present do
          !defined?(::Delayed).nil?
        end

        compatible do
          gem_version >= MINIMUM_VERSION
        end

        private

        def gem_version
          Gem.loaded_specs['delayed_job'].version
        end

        def require_dependencies
          require_relative 'plugins/tracer_plugin'
        end

        def register_tracer_plugin
          ::Delayed::Worker.plugins << Plugins::TracerPlugin
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-delayed_job-0.18.4 lib/opentelemetry/instrumentation/delayed_job/instrumentation.rb
opentelemetry-instrumentation-delayed_job-0.18.3 lib/opentelemetry/instrumentation/delayed_job/instrumentation.rb
opentelemetry-instrumentation-delayed_job-0.18.2 lib/opentelemetry/instrumentation/delayed_job/instrumentation.rb
opentelemetry-instrumentation-delayed_job-0.18.1 lib/opentelemetry/instrumentation/delayed_job/instrumentation.rb
opentelemetry-instrumentation-delayed_job-0.18.0 lib/opentelemetry/instrumentation/delayed_job/instrumentation.rb
opentelemetry-instrumentation-delayed_job-0.17.0 lib/opentelemetry/instrumentation/delayed_job/instrumentation.rb
opentelemetry-instrumentation-delayed_job-0.16.0 lib/opentelemetry/instrumentation/delayed_job/instrumentation.rb
opentelemetry-instrumentation-delayed_job-0.15.0 lib/opentelemetry/instrumentation/delayed_job/instrumentation.rb
opentelemetry-instrumentation-delayed_job-0.14.0 lib/opentelemetry/instrumentation/delayed_job/instrumentation.rb
opentelemetry-instrumentation-delayed_job-0.13.0 lib/opentelemetry/instrumentation/delayed_job/instrumentation.rb