In ApsaraMQ for RabbitMQ, a message trace is the complete route record of a message from the publication by a producer to the consumption by a consumer. A message trace consists of the time, status, and other information on each node. If messages are not sent or received as expected, you can query message traces to analyze and identify issues. This way, you can resume your business at the earliest opportunity.
Background information
ApsaraMQ for RabbitMQ allows you to use the following methods to query messages:
Query by queue: This method is suitable for fuzzy query scenarios in which you record only the information about the queue to which the message is sent but not the message ID that is specified before the message is sent.
Query by message ID: This method is suitable for exact query scenarios in which you record the message ID that is specified before the message is sent. For more information, see How do I specify a message ID?
Query by message processing duration: This method is suitable for fuzzy query scenarios in which you record the time range when the message is processed. Message processing duration specifies the time period from the point in time when the message is delivered to the point in time when the client sends an acknowledgment (ACK) after the client receives the message.
Limits
When you use the message trace feature in ApsaraMQ for RabbitMQ, take note of the following limits:
You can query message traces on an ApsaraMQ for RabbitMQ instance only if the instance supports the message trace feature.
NoteWhen you create an ApsaraMQ for RabbitMQ instance, you can specify whether to enable the message trace feature for the instance and specify a time range to query message traces. If the message trace feature is not enabled for an ApsaraMQ for RabbitMQ instance, you can upgrade the configurations of the instance to enable the message trace feature. For more information, see Upgrade or downgrade instance configurations.
You can query message traces for the previous 3, 7, or 15 days from the local time.
For example, you can query message traces for the previous three days from the local time. If the local time is 10:45:18 on April 12, 2022, the earliest message traces that you can query are generated at 10:45:18 on April 9, 2022.
Prerequisites
The message trace feature is enabled for the ApsaraMQ for RabbitMQ instance.
A message is sent to or consumed from the ApsaraMQ for RabbitMQ instance.
Procedure
Log on to the ApsaraMQ for RabbitMQ console. In the left-side navigation pane, click Instances.
In the top navigation bar of the Instances page, select the region where the instance that you want to manage resides. Then, in the instance list, click the name of the instance that you want to manage.
In the left-side navigation pane, click Message Tracing.
On the Message Tracing page, select the vhost to which the message that you want to query belongs and then select a query method based on your business requirements.
Query by queue: On the Query by Queue tab, select the queue to which the message that you want to query belongs, configure the Time Range parameter, and then click Query.
Query by message ID: On the Query by Message ID tab, enter the ID of the message that you want to query, configure the Time Range parameter, and then click Query.
Query by message processing duration: On the By Message Processing Duration tab, select the queue to which the message that you want to query belongs, enter the message processing duration in seconds, configure the Time Range parameter, and then click Query.
In the message list, find the message whose trace you want to query and click Trace Details in the Actions column.
On the Message Trace Details page, view the details of the message trace.
The following table describes the parameters in a message trace:
Section
Parameter
Description
Overview
Vhost
The vhost to which the message belongs.
Message ID
The message ID.
Production Details
Arrival Time
The point in time when the message arrived at the ApsaraMQ for RabbitMQ instance.
Exchange
The ApsaraMQ for RabbitMQ exchange to which the message was sent.
Routing Key
The routing key that was used to route the message to the queue.
Producer IP
The IP address of the producer client.
Producer Account
The ID of the Alibaba Cloud account or the Resource Access Management (RAM) user that was used when the producer sent the message to the ApsaraMQ for RabbitMQ instance.
Result of Entering Queue
None
The name of the ApsaraMQ for RabbitMQ queue to which the message was delivered.
Delivery Details
Delivery Time
The point in time when the message was delivered to the queue.
Consumer IP
The IP address of the consumer client.
Consumer Account
The ID of the Alibaba Cloud account or RAM user that was used when the message was consumed from the ApsaraMQ for RabbitMQ instance.
Consumption Method
The request method that was used when the message was consumed. For more information, see Peak TPS in Billing rules.
autoAck
Indicates whether an ACK was automatically sent after the message was consumed.
deliveryTag
The ordinal number that was used for delivering the message. An ordinal number is automatically generated when the ApsaraMQ for RabbitMQ instance pushes a message to the consumer.
consumerTag
The consumer tag. The consumer tag is a unique identifier of a consumer client. A consumer tag can be specified in the consumer client code of an ApsaraMQ for RabbitMQ instance or automatically generated by an ApsaraMQ for RabbitMQ broker.
Final Result
The message consumption result.
Consumer Response Details
Response Time
The point in time when the client sent an ACK after the message was delivered.
Response Method
The method that the client used to send an ACK after the message was consumed.
Response Parameters
Indicates whether the client automatically sent an ACK after the message was consumed.
Response Result
Indicates whether the client successfully sent the ACK after the message was consumed.