Class: ElasticAPM::Spies::ElasticsearchSpy Private
- Inherits:
-
Object
- Object
- ElasticAPM::Spies::ElasticsearchSpy
- Defined in:
- lib/elastic_apm/spies/elasticsearch.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- NAME_FORMAT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'%s %s'.freeze
- TYPE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'db.elasticsearch'.freeze
Instance Method Summary collapse
-
#install ⇒ Object
private
rubocop:disable Metrics/MethodLength.
Instance Method Details
#install ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:disable Metrics/MethodLength
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/elastic_apm/spies/elasticsearch.rb', line 12 def install ::Elasticsearch::Transport::Client.class_eval do alias perform_request_without_apm perform_request def perform_request(method, path, *args, &block) name = format(NAME_FORMAT, method, path) statement = args[0].is_a?(String) ? args[0] : args[0].to_json context = Span::Context.new(statement: statement) ElasticAPM.span name, TYPE, context: context do perform_request_without_apm(method, path, *args, &block) end end end end |