Sha256: e1896f916c6f321c86149e3b775029a1a0a46eb9fed2d7394e46fb241ce71566

Contents?: true

Size: 815 Bytes

Versions: 3

Compression:

Stored size: 815 Bytes

Contents

module Datadog
  module Contrib
    module Resque
      SERVICE = 'resque'.freeze

      # Patcher for Resque integration - sets up the pin for the integration
      module Patcher
        @patched = false

        class << self
          def patch
            return @patched if patched? || !defined?(::Resque)

            require 'ddtrace/ext/app_types'

            add_pin
            @patched = true
          rescue => e
            Tracer.log.error("Unable to apply Resque integration: #{e}")
            @patched
          end

          def patched?
            @patched
          end

          private

          def add_pin
            Pin.new(SERVICE, app_type: Ext::AppTypes::WORKER).tap do |pin|
              pin.onto(::Resque)
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ddtrace-0.9.2 lib/ddtrace/contrib/resque/patcher.rb
ddtrace-0.9.1 lib/ddtrace/contrib/resque/patcher.rb
ddtrace-0.9.0 lib/ddtrace/contrib/resque/patcher.rb