13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb', line 13
def perform_request_with_tracing(method, path, params = {}, body = nil, = nil)
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
|