Module: BrainzLab::Instrumentation::ElasticsearchInstrumentation::ClientPatch

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

Overview

Patch for Elasticsearch/OpenSearch clients

Instance Method Summary collapse

Instance Method Details

#perform_request(method, path, params = {}, body = nil, headers = nil) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/brainzlab/instrumentation/elasticsearch.rb', line 63

def perform_request(method, path, params = {}, body = nil, headers = nil)
  return super unless should_track?

  started_at = Time.now.utc

  begin
    response = super
    record_request(method, path, params, started_at, response.status)
    response
  rescue StandardError => e
    record_request(method, path, params, started_at, nil, e)
    raise
  end
end