Module: BrainzLab::Instrumentation::ElasticsearchInstrumentation

Defined in:
lib/brainzlab/instrumentation/elasticsearch.rb

Defined Under Namespace

Modules: ClientPatch

Class Method Summary collapse

Class Method Details

.install!Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/brainzlab/instrumentation/elasticsearch.rb', line 9

def install!
  return if @installed

  installed_any = false

  # Elasticsearch gem (elasticsearch-ruby)
  if defined?(::Elasticsearch::Transport::Client)
    install_elasticsearch_transport!
    installed_any = true
  end

  # OpenSearch gem
  if defined?(::OpenSearch::Client)
    install_opensearch!
    installed_any = true
  end

  # Elasticsearch 8.x with new client
  if defined?(::Elastic::Transport::Client)
    install_elastic_transport!
    installed_any = true
  end

  return unless installed_any

  @installed = true
  BrainzLab.debug_log('Elasticsearch instrumentation installed')
end

.installed?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/brainzlab/instrumentation/elasticsearch.rb', line 38

def installed?
  @installed
end

.reset!Object



42
43
44
# File 'lib/brainzlab/instrumentation/elasticsearch.rb', line 42

def reset!
  @installed = false
end