Sha256: 240db1ee3be401d5ac7b5fe7ca74e41f7380b363247f077ff39ee2580e3dc1fd

Contents?: true

Size: 955 Bytes

Versions: 24

Compression:

Stored size: 955 Bytes

Contents

require_relative '../../../core/utils/only_once'
require_relative 'instrumentation'
require_relative '../patcher'

module Datadog
  module Tracing
    module Contrib
      # Datadog Httpclient integration.
      module Httpclient
        # Patcher enables patching of 'httpclient' module.
        module Patcher
          include Contrib::Patcher

          PATCH_ONLY_ONCE = Core::Utils::OnlyOnce.new

          module_function

          def patched?
            PATCH_ONLY_ONCE.ran?
          end

          def target_version
            Integration.version
          end

          # patch applies our patch
          def patch
            PATCH_ONLY_ONCE.run do
              begin
                ::HTTPClient.include(Instrumentation)
              rescue StandardError => e
                Datadog.logger.error("Unable to apply httpclient integration: #{e}")
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
ddtrace-1.23.3 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.23.2 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.23.1 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.22.0 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.21.1 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.21.0 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.20.0 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.19.0 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.18.0 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.17.0 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.16.2 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.16.1 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.16.0 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.15.0 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.14.0 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.13.1 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.13.0 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.12.1 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.12.0 lib/datadog/tracing/contrib/httpclient/patcher.rb
ddtrace-1.11.1 lib/datadog/tracing/contrib/httpclient/patcher.rb