Class: NewRelic::Agent::Transaction::DistributedTracer
Constant Summary
TraceContext::ACCEPT_EXCEPTION_METRIC, TraceContext::ACCEPT_PREFIX, TraceContext::ACCEPT_SUCCESS_METRIC, TraceContext::CREATE_EXCEPTION_METRIC, TraceContext::CREATE_PREFIX, TraceContext::CREATE_SUCCESS_METRIC, TraceContext::IGNORE_ACCEPT_AFTER_CREATE_METRIC, TraceContext::IGNORE_MULTIPLE_ACCEPT_METRIC, TraceContext::INVALID_TRACESTATE_PAYLOAD_METRIC, TraceContext::NO_NR_ENTRY_TRACESTATE_METRIC, TraceContext::SUPPORTABILITY_PREFIX, TraceContext::TRACESTATE_PREFIX
SupportabilityHelper::API_SUPPORTABILITY_METRICS, SupportabilityHelper::API_SUPPORTABILITY_PREFIX
CrossAppTracing::NR_APPDATA_HEADER, CrossAppTracing::NR_ID_HEADER, CrossAppTracing::NR_MESSAGE_BROKER_ID_HEADER, CrossAppTracing::NR_MESSAGE_BROKER_SYNTHETICS_HEADER, CrossAppTracing::NR_MESSAGE_BROKER_TXN_HEADER, CrossAppTracing::NR_TXN_HEADER
Instance Attribute Summary collapse
Attributes included from TraceContext
#trace_context_header_data, #trace_state_payload
#cat_path_hashes, #cross_app_payload, #is_cross_app_caller
Instance Method Summary
collapse
#accept_trace_context, #assign_trace_state_payload, #create_trace_state, #create_trace_state_payload, #ignore_trace_context?, #insert_trace_context_header, #trace_context_inserted?, #trace_parent_header_present?
Methods included from Coerce
boolean_int!, float, float!, int, int!, int_or_nil, log_failure, scalar, string, value_or_nil
#accept_distributed_trace_headers, #insert_distributed_trace_headers
#record_api_supportability_metric, #valid_api_argument_class?
#add_message_cat_headers, #assign_cross_app_intrinsics, #cat_path_hash, #cat_trip_id, #cross_app_monitor, #insert_cross_app_header, #is_cross_app?, #is_cross_app_callee?, #is_cross_app_caller?, #record_cross_app_metrics
Constructor Details
Returns a new instance of DistributedTracer.
53
54
55
|
# File 'lib/new_relic/agent/transaction/distributed_tracer.rb', line 53
def initialize(transaction)
@transaction = transaction
end
|
Instance Attribute Details
#parent_transaction_id ⇒ Object
18
19
20
|
# File 'lib/new_relic/agent/transaction/distributed_tracer.rb', line 18
def parent_transaction_id
@parent_transaction_id
end
|
#transaction ⇒ Object
17
18
19
|
# File 'lib/new_relic/agent/transaction/distributed_tracer.rb', line 17
def transaction
@transaction
end
|
Instance Method Details
#accept_incoming_request(request, transport_type = nil) ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/new_relic/agent/transaction/distributed_tracer.rb', line 28
def accept_incoming_request(request, transport_type = nil)
accept_incoming_transport_type(request, transport_type)
if (request)
accept_trace_context_incoming_request(request)
else
accept_distributed_tracing_incoming_request(request)
end
end
|
#accept_incoming_transport_type(request, transport_type) ⇒ Object
#accept_transport_type_from_api(value) ⇒ Object
41
42
43
|
# File 'lib/new_relic/agent/transaction/distributed_tracer.rb', line 41
def accept_transport_type_from_api(value)
@caller_transport_type = DistributedTraceTransportType.from(value)
end
|
#append_payload(payload) ⇒ Object
62
63
64
65
66
67
68
69
|
# File 'lib/new_relic/agent/transaction/distributed_tracer.rb', line 62
def append_payload(payload)
append_cat_info(payload)
DistributedTraceAttributes.copy_from_transaction( \
transaction,
trace_state_payload || distributed_trace_payload,
payload
)
end
|
#assign_intrinsics ⇒ Object
94
95
96
97
98
99
100
|
# File 'lib/new_relic/agent/transaction/distributed_tracer.rb', line 94
def assign_intrinsics
if dt_enabled?
DistributedTraceAttributes.copy_to_attributes(transaction.payload, transaction.attributes)
elsif is_cross_app?
assign_cross_app_intrinsics
end
end
|
#caller_transport_type ⇒ Object
37
38
39
|
# File 'lib/new_relic/agent/transaction/distributed_tracer.rb', line 37
def caller_transport_type
@caller_transport_type ||= 'Unknown'
end
|
85
86
87
88
89
90
91
92
|
# File 'lib/new_relic/agent/transaction/distributed_tracer.rb', line 85
def (, tracer_state, transport_type)
(, 'INCOMING')
(, transport_type)
(, tracer_state)
()
rescue => e
NewRelic::Agent.logger.error('Error in consume_message_headers', e)
end
|
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/new_relic/agent/transaction/distributed_tracer.rb', line 110
def ()
return unless CrossAppTracing.cross_app_enabled?
@is_cross_app_caller = true
(,
transaction.guid,
cat_trip_id,
cat_path_hash,
transaction.)
end
|
102
103
104
105
106
107
108
|
# File 'lib/new_relic/agent/transaction/distributed_tracer.rb', line 102
def ()
return unless dt_enabled?
return if Agent.config[:'exclude_newrelic_header']
payload = create_distributed_trace_payload
[NewRelic::NEWRELIC_KEY] = payload.http_safe if payload
end
|
76
77
78
79
80
81
82
83
|
# File 'lib/new_relic/agent/transaction/distributed_tracer.rb', line 76
def ()
return unless NewRelic::Agent.agent.connected?
()
()
()
()
end
|
#parent_guid ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/new_relic/agent/transaction/distributed_tracer.rb', line 20
def parent_guid
if
.parent_id
elsif distributed_trace_payload
distributed_trace_payload.id
end
end
|