lib/new_relic/agent/instrumentation/bunny/instrumentation.rb in newrelic_rpm-9.11.0 vs lib/new_relic/agent/instrumentation/bunny/instrumentation.rb in newrelic_rpm-9.12.0
- old
+ new
@@ -46,10 +46,16 @@
routing_key: opts[:routing_key] || opts[:key],
reply_to: opts[:reply_to],
correlation_id: opts[:correlation_id],
exchange_type: type
)
+ if segment
+ segment.add_agent_attribute('server.address', channel&.connection&.hostname)
+ segment.add_agent_attribute('server.port', channel&.connection&.port)
+ segment.add_agent_attribute('messaging.destination.name', destination) # for produce, this is exchange name
+ segment.add_agent_attribute('messaging.rabbitmq.destination.routing_key', opts[:routing_key])
+ end
rescue => e
NewRelic::Agent.logger.error('Error starting message broker segment in Bunny::Exchange#publish', e)
yield
else
NewRelic::Agent::Tracer.capture_segment_error(segment) do
@@ -92,9 +98,17 @@
message_properties: (message_properties || {headers: {}}),
exchange_type: exch_type,
queue_name: name,
start_time: t0
)
+ if segment
+ segment.add_agent_attribute('server.address', channel&.connection&.hostname)
+ segment.add_agent_attribute('server.port', channel&.connection&.port)
+ segment.add_agent_attribute('messaging.destination.name', name) # for consume, this is queue name
+ segment.add_agent_attribute('messaging.destination_publish.name', exch_name)
+ segment.add_agent_attribute('message.queueName', name)
+ segment.add_agent_attribute('messaging.rabbitmq.destination.routing_key', delivery_info&.routing_key)
+ end
rescue => e
NewRelic::Agent.logger.error('Error starting message broker segment in Bunny::Queue#pop', e)
else
if bunny_error
segment.notice_error(bunny_error)