Sha256: b25f833d3e39d301f07b73fccbc5ce6b580b4dce10893214bd30489cb86fdf89

Contents?: true

Size: 1.09 KB

Versions: 17

Compression:

Stored size: 1.09 KB

Contents

require 'ddtrace/ext/app_types'

module Datadog
  module Contrib
    module Excon
      # Responsible for hooking the instrumentation into Excon
      module Patcher
        include Base

        DEFAULT_SERVICE = 'excon'.freeze

        register_as :excon
        option :tracer, default: Datadog.tracer
        option :service_name, default: DEFAULT_SERVICE
        option :distributed_tracing, default: false
        option :split_by_domain, default: false
        option :error_handler, default: nil

        @patched = false

        module_function

        def patch
          return @patched if patched? || !compatible?

          require 'ddtrace/contrib/excon/middleware'

          add_middleware

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

        def patched?
          @patched
        end

        def compatible?
          defined?(::Excon)
        end

        def add_middleware
          ::Excon.defaults[:middlewares] = Middleware.around_default_stack
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ddtrace-0.16.1 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.15.0.internaltracinfeature1 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.16.0 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.14.2.disableprotocolversion4 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.15.0 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.14.2.withoutpriorityparsing1 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.14.2 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.14.1 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.15.0.beta1 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.14.0 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.14.0.rc1 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.13.2 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.14.0.beta2 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.14.0.beta1 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.13.1 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.13.0 lib/ddtrace/contrib/excon/patcher.rb
ddtrace-0.13.0.beta1 lib/ddtrace/contrib/excon/patcher.rb