The New Relic Python agent supports the Pika RabbitMQ client library, giving you visibility into the performance of your message processing, for both incoming and outgoing messages.
The New Relic APM UI will show transactions initiated via RabbitMQ message receipt (subscribe/consume messages) as Message background tasks. Message creation via RabbitMQ also appears in transaction traces.
Requires New Relic Python agent version 220.127.116.11 or higher.
Message tasks are not started for consumers using TornadoConnection.
Performance improvements with background tasks
One way to increase responsiveness of web applications is to delegate work to background processes. Message queues are commonly used for this inter-process communication.
In the context of message queuing systems, applications typically interact with message brokers to send and receive messages. The RabbitMQ Pika client library allows Python applications to interface with message brokers that implement the Advanced Message Queueing Protocol (AMQP) 0.9 or higher.
New Relic's Python agent shows messages sent and received using the RabbitMQ client library. With this visibility, you can see details including:
- Number of messages produced by your app
- Time your app spends publishing messages
- Time your app spends processing "consumed" messages
New Relic APM conveniently groups and reports operations that interact with queues. By analyzing this information, you can more easily identify bottlenecks and areas for performance improvement in your message passing architecture.
Supported entry points for queue operations appear as
Put (publish a message) or
Take (receive a message) in New Relic APM's user interface.
|Queue operations||Publish a message (
||Receive a message (
View in New Relic UI
Queue operations appear on New Relic APM's Transactions page for the selected app. The
Take metrics appear in the Breakdown table and are categorized as
MessageBroker metrics. Here is an example:
Transaction traces also provide additional details for messages.
You can select transaction traces from the app's Overview or Transactions pages in New Relic APM.
The Transaction trace summary page may show
Take operations in the Slowest components section. For example:
The Transaction trace page includes a dedicated Messages tab that shows a summary of the message activity that occurred as part of the transaction. Here is an example: