class NewRelic::Agent::Transaction::MessageBrokerSegment

Constants

ACTIONS
CONSUME
DESTINATION_TYPES
EXCHANGE
METRIC_PREFIX
NAMED
PRODUCE
PURGE
QUEUE
TEMP
TOPIC
TYPES
UNKNOWN

Attributes

action[R]
destination_name[R]
destination_type[R]
headers[R]
library[R]

Public Class Methods

new(action:, library:, destination_type:, destination_name:, headers: nil, parameters: nil, start_time: nil) click to toggle source
Calls superclass method
# 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 = headers
  super(nil, nil, start_time)
  params.merge!(parameters) if parameters
end

Public Instance Methods

name() click to toggle source
# 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() click to toggle source
# File lib/new_relic/agent/transaction/message_broker_segment.rb, line 86
def transaction_assigned
  if headers && transaction && action == :produce && record_metrics?
    transaction.distributed_tracer.insert_distributed_trace_header(headers)
    transaction.distributed_tracer.insert_cat_headers(headers)
    transaction.distributed_tracer.log_request_headers(headers)
  end
rescue => e
  NewRelic::Agent.logger.error('Error during message header processing', e)
end