Module: Datadog::Tracing::Contrib::Elasticsearch::Patcher

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

Overview

Patcher enables patching of ‘elasticsearch’ module.

Defined Under Namespace

Modules: Client, DatadogPin

Constant Summary collapse

SELF_DEPRECATION_ONLY_ONCE =
Core::Utils::OnlyOnce.new

Class Method Summary collapse

Methods included from Patcher

included

Class Method Details

.patchObject



24
25
26
27
28
29
30
31
# File 'lib/datadog/tracing/contrib/elasticsearch/patcher.rb', line 24

def patch
  require 'uri'
  require 'json'
  require_relative 'quantize'

  transport_module::Client.prepend(DatadogPin)
  transport_module::Client.prepend(Client)
end

.target_versionObject



20
21
22
# File 'lib/datadog/tracing/contrib/elasticsearch/patcher.rb', line 20

def target_version
  Integration.version
end

.transport_moduleObject

‘Elasticsearch` namespace renamed to `Elastic` in version 8.0.0 of the transport gem:



158
159
160
161
162
163
164
# File 'lib/datadog/tracing/contrib/elasticsearch/patcher.rb', line 158

def transport_module
  if Integration.version >= Gem::Version.new('8.0.0')
    ::Elastic::Transport
  else
    ::Elasticsearch::Transport
  end
end