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 services at the earliest opportunity. This topic describes the background information and prerequisites of message traces. This topic also describes the limits on message traces and the procedure for using message traces.
Background information
A message trace includes the complete trace information of a message during the process in which the message is sent from a producer and consumed by a consumer on a ApsaraMQ for RabbitMQ broker. A message trace includes information such as the time and status of each step in the process.
- 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 indicates 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
Before you use the message trace feature in ApsaraMQ for RabbitMQ, take note of the following limits:
- You can query message traces in an instance only if the instance supports the message trace feature.
- You can query message traces of the previous three days, seven days, or 15 days from the local time.
For example, you can query message traces of 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 can be queried are generated at 10:45:18 on April 9, 2022.
When you create an 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 instance, you can upgrade the configurations of the instance to enable the message trace feature. For more information, see Upgrade the configurations of an instance.
Prerequisites
- The message trace feature is enabled for the instance.
- You have sent a message to the ApsaraMQ for RabbitMQ instance or consumed a message from the ApsaraMQ for RabbitMQ instance.
Procedure
- Log on to the ApsaraMQ for RabbitMQ console. In the left-side navigation pane, select Instances.
- In the top navigation bar of the Instances page, select a region. 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 in which you want to query the message, and then select a query method based on your business requirements.
- Query by queue: On the Query by Queue tab, select the queue in which you want to query the message, 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 clickQuery.
- Query by message processing duration: On the By Message Processing Duration tab, select the queue in which you want to query the message, enter the message processing duration in seconds, configure the Time Range parameter, and then clickQuery.
- In the message list that appears, 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 of the message trace:
Section Parameter Description Overview Vhost The vhost to which the message belongs. Message ID The ID of the message. Production Details Arrival Time The point in time when the message that is produced by the client arrives at the ApsaraMQ for RabbitMQ instance. Exchange The exchange to which the message that is produced by the client is sent in the ApsaraMQ for RabbitMQ instance. Routing Key The routing key that is 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 RAM user that is used when the message producer sends the message to the ApsaraMQ for RabbitMQ instance. Result of Entering Queue N/A The name of the queue to which the message is delivered in the ApsaraMQ for RabbitMQ instance. Delivery Details (queue) Delivery Time The point in time when the message is 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 is used when the message is consumed from the ApsaraMQ for RabbitMQ instance. Consumption Method The request method that is used when the message is consumed. For information about consumption methods, see Peak TPS in Billing rules. autoAck Indicates whether an ACK is automatically sent after the message is consumed. deliveryTag The ordinal number that is used for the message delivery. An ordinal number is automatically generated when the ApsaraMQ for RabbitMQ instance pushes a message to the consumer. consumerTag The consumer tag. A consumer tag is a unique identifier of a consumer client. A consumer tag can be specified in the consumer client code of a ApsaraMQ for RabbitMQ instance or automatically generated by a 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.