Module: NewRelic::Agent::Instrumentation::Elasticsearch
- Included in:
- Elasticsearch::Prepend
- Defined in:
- lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb
Defined Under Namespace
Constant Summary collapse
- PRODUCT_NAME =
'Elasticsearch'
- OPERATION =
'perform_request'
- INSTRUMENTATION_NAME =
NewRelic::Agent.base_name(name)
Instance Method Summary collapse
-
#perform_request_with_tracing(_method, _path, params = {}, body = nil, _headers = nil, *_args) ⇒ Object
We need the positional arguments ‘params` and `body` to capture the nosql statement *args protects the instrumented method if new arguments are added to perform_request.
Instance Method Details
#perform_request_with_tracing(_method, _path, params = {}, body = nil, _headers = nil, *_args) ⇒ Object
We need the positional arguments ‘params` and `body` to capture the nosql statement *args protects the instrumented method if new arguments are added to perform_request
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb', line 17 def perform_request_with_tracing(_method, _path, params = {}, body = nil, _headers = nil, *_args) return yield unless NewRelic::Agent::Tracer.tracing_enabled? NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME) segment = NewRelic::Agent::Tracer.start_datastore_segment( product: PRODUCT_NAME, operation: nr_operation || OPERATION, host: nr_hosts[:host], port_path_or_id: nr_hosts[:port], database_name: nr_cluster_name ) begin NewRelic::Agent::Tracer.capture_segment_error(segment) { yield } ensure if segment segment.notice_nosql_statement(nr_reported_query(body || params)) segment.finish end end end |