Module: Datadog::Tracing::Contrib::Httpclient::Patcher

Includes:
Patcher
Defined in:
lib/datadog/tracing/contrib/httpclient/patcher.rb

Overview

Patcher enables patching of ‘httpclient’ module.

Constant Summary collapse

PATCH_ONLY_ONCE =
Core::Utils::OnlyOnce.new

Class Method Summary collapse

Methods included from Patcher

included

Class Method Details

.patchObject

patch applies our patch



27
28
29
30
31
32
33
34
35
# File 'lib/datadog/tracing/contrib/httpclient/patcher.rb', line 27

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

.patched?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/datadog/tracing/contrib/httpclient/patcher.rb', line 18

def patched?
  PATCH_ONLY_ONCE.ran?
end

.target_versionObject



22
23
24
# File 'lib/datadog/tracing/contrib/httpclient/patcher.rb', line 22

def target_version
  Integration.version
end