Class: NewRelic::Agent::Transaction::MessageBrokerSegment
- Inherits:
-
Segment
show all
- Defined in:
- lib/new_relic/agent/transaction/message_broker_segment.rb
Constant Summary
collapse
- CONSUME =
'Consume'.freeze
- EXCHANGE =
'Exchange'.freeze
- NAMED =
'Named/'.freeze
- PRODUCE =
'Produce'.freeze
- QUEUE =
'Queue'.freeze
- PURGE =
'Purge'.freeze
- TEMP =
'Temp'.freeze
- TOPIC =
'Topic'.freeze
- UNKNOWN =
'Unknown'.freeze
- DESTINATION_TYPES =
[
:exchange,
:queue,
:topic,
:temporary_queue,
:temporary_topic,
:unknown
]
- ACTIONS =
{
consume: CONSUME,
produce: PRODUCE,
purge: PURGE
}
- TYPES =
{
exchange: EXCHANGE,
temporary_queue: QUEUE,
queue: QUEUE,
temporary_topic: TOPIC,
topic: TOPIC,
unknown: EXCHANGE
}
- METRIC_PREFIX =
'MessageBroker/'.freeze
AbstractSegment::CALLBACK, AbstractSegment::INSPECT_IGNORE, AbstractSegment::SEGMENT
Instance Attribute Summary collapse
Attributes inherited from Segment
#custom_transaction_attributes, #unscoped_metrics
#children_time, #duration, #end_time, #exclusive_duration, #guid, #llm_event, #noticed_error, #parent, #record_on_finish, #record_scoped_metric, #start_time, #starting_segment_key, #transaction, #transaction_name
Instance Method Summary
collapse
Methods inherited from Segment
#add_agent_attribute, #add_custom_attributes, #attributes, finish, #merge_untrusted_agent_attributes, merge_untrusted_agent_attributes
#all_code_information_present?, #children_time_ranges?, #code_attributes, #code_information=, #concurrent_children?, #finalize, #finish, #finished?, #inspect, #notice_error, #noticed_error_attributes, #params, #params?, #record_metrics?, #record_on_finish?, #record_scoped_metric?, #set_noticed_error, #start, #time_range
Constructor Details
#initialize(action:, library:, destination_type:, destination_name:, headers: nil, parameters: nil, start_time: nil) ⇒ MessageBrokerSegment
Returns a new instance of MessageBrokerSegment.
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/new_relic/agent/transaction/message_broker_segment.rb', line 54
def initialize(action:,
library:,
destination_type:,
destination_name:,
headers: nil,
parameters: nil,
start_time: nil)
@action = action
@library = library
@destination_type = destination_type
@destination_name = destination_name
@headers =
super(nil, nil, start_time)
params.merge!(parameters) if parameters
end
|
Instance Attribute Details
#action ⇒ Object
48
49
50
|
# File 'lib/new_relic/agent/transaction/message_broker_segment.rb', line 48
def action
@action
end
|
#destination_name ⇒ Object
48
49
50
|
# File 'lib/new_relic/agent/transaction/message_broker_segment.rb', line 48
def destination_name
@destination_name
end
|
#destination_type ⇒ Object
48
49
50
|
# File 'lib/new_relic/agent/transaction/message_broker_segment.rb', line 48
def destination_type
@destination_type
end
|
48
49
50
|
# File 'lib/new_relic/agent/transaction/message_broker_segment.rb', line 48
def
@headers
end
|
#library ⇒ Object
48
49
50
|
# File 'lib/new_relic/agent/transaction/message_broker_segment.rb', line 48
def library
@library
end
|
Instance Method Details
#name ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/new_relic/agent/transaction/message_broker_segment.rb', line 71
def name
return @name if @name
@name = METRIC_PREFIX + library
@name << NewRelic::SLASH << TYPES[destination_type] << NewRelic::SLASH << ACTIONS[action] << NewRelic::SLASH
if destination_type == :temporary_queue || destination_type == :temporary_topic
@name << TEMP
else
@name << NAMED << destination_name.to_s
end
@name
end
|
#transaction_assigned ⇒ Object
86
87
88
89
90
91
92
93
94
|
# File 'lib/new_relic/agent/transaction/message_broker_segment.rb', line 86
def transaction_assigned
if && transaction && action == :produce && record_metrics?
transaction.distributed_tracer.()
transaction.distributed_tracer.()
transaction.distributed_tracer.()
end
rescue => e
NewRelic::Agent.logger.error('Error during message header processing', e)
end
|