Module: NewRelic::Agent::OpenTelemetry::TransactionPatch
- Defined in:
- lib/new_relic/agent/opentelemetry/transaction_patch.rb
Instance Method Summary collapse
-
#add_span_event_event(name, attributes: nil, timestamp: nil) ⇒ Object
This method adds a SpanEvent event to the Transaction’s initial segment.
- #add_span_link(link) ⇒ Object
- #finish ⇒ Object
- #remove_current_segment_by_thread_id(id) ⇒ Object
- #set_current_segment(new_segment) ⇒ Object
-
#span_events ⇒ Object
Used to reference SpanEvent events associated with the initial segment.
- #span_links ⇒ Object
Instance Method Details
#add_span_event_event(name, attributes: nil, timestamp: nil) ⇒ Object
This method adds a SpanEvent event to the Transaction’s initial segment. A SpanEvent is used to denote a meaningful, singular point in a Span’s duration.
45 46 47 |
# File 'lib/new_relic/agent/opentelemetry/transaction_patch.rb', line 45 def add_span_event_event(name, attributes: nil, timestamp: nil) initial_segment&.add_span_event_event(name, attributes: attributes, timestamp: ) end |
#add_span_link(link) ⇒ Object
34 35 36 |
# File 'lib/new_relic/agent/opentelemetry/transaction_patch.rb', line 34 def add_span_link(link) initial_segment&.add_span_link(link) end |
#finish ⇒ Object
28 29 30 31 32 |
# File 'lib/new_relic/agent/opentelemetry/transaction_patch.rb', line 28 def finish NewRelic::Agent::TransactionTimeAggregator.current_execution_context[:nr_otel_current_span] = nil super end |
#remove_current_segment_by_thread_id(id) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/new_relic/agent/opentelemetry/transaction_patch.rb', line 20 def remove_current_segment_by_thread_id(id) if id == NewRelic::Agent::TransactionTimeAggregator.current_execution_context_id NewRelic::Agent::TransactionTimeAggregator.current_execution_context[:nr_otel_current_span] = nil end super end |
#set_current_segment(new_segment) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/new_relic/agent/opentelemetry/transaction_patch.rb', line 9 def set_current_segment(new_segment) @current_segment_lock.synchronize do if new_segment&.respond_to?(:transaction) && new_segment.transaction span = find_or_create_span(new_segment) NewRelic::Agent::TransactionTimeAggregator.current_execution_context[:nr_otel_current_span] = span end end super end |
#span_events ⇒ Object
Used to reference SpanEvent events associated with the initial segment.
50 51 52 |
# File 'lib/new_relic/agent/opentelemetry/transaction_patch.rb', line 50 def span_events initial_segment&.span_events || NewRelic::EMPTY_ARRAY end |
#span_links ⇒ Object
38 39 40 |
# File 'lib/new_relic/agent/opentelemetry/transaction_patch.rb', line 38 def span_links initial_segment&.span_links || NewRelic::EMPTY_ARRAY end |