Module: ElasticAPM::Spies::ElasticsearchSpy::Ext Private
- Defined in:
- lib/elastic_apm/spies/elasticsearch.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
Instance Method Details
#perform_request(method, path, *args, &block) ⇒ 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.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/elastic_apm/spies/elasticsearch.rb', line 42 def perform_request(method, path, *args, &block) unless ElasticAPM.current_transaction return super(method, path, *args, &block) end name = format(NAME_FORMAT, method, path) statement = [] statement << { params: args&.[](0) } if ElasticAPM.agent.config.capture_elasticsearch_queries unless args[1].nil? || args[1].empty? body = ElasticAPM::Spies::ElasticsearchSpy .sanitizer.strip_from(args[1]) statement << { body: body } end end context = Span::Context.new( db: { statement: statement.reduce({}, :merge).to_json }, destination: { service: { name: SUBTYPE, resource: SUBTYPE, type: TYPE } } ) ElasticAPM.with_span( name, TYPE, subtype: SUBTYPE, context: context ) { super(method, path, *args, &block) } end |