9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/new_relic/agent/opentelemetry/trace_patch.rb', line 9
def current_span(context = nil)
return super if context
storage = NewRelic::Agent::TransactionTimeAggregator.current_execution_context
return super if storage[:nr_otel_recursion_guard]
nr_span = storage[:nr_otel_current_span]
return nr_span if nr_span
storage[:nr_otel_recursion_guard] = true
result = super
storage[:nr_otel_recursion_guard] = nil
result
rescue => e
NewRelic::Agent.logger.debug("Error in OpenTelemetry.current_span override, falling back to original implementation: #{e}")
super
end
|