If messages are not sent and received as expected, you can query message traces to analyze and locate issues. This way, you can resume your services at the earliest opportunity. This topic describes the background information of message traces and the limits, prerequisites, and procedure for using message traces.

Background information

A message trace is the complete trace of a message that is sent from a producer to a Message Queue for RabbitMQ broker and then consumed by a consumer. The message trace includes information such as time and status about each step of the process.

Message Queue for RabbitMQ allows you to query message traces by using one of the following methods:
  • Query by queue: This method is suitable for fuzzy query scenarios in which you recorded information about the queue to which the message is sent, but did not record the message ID that is specified when 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 when 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 recorded the approximate time that is consumed when the message is processed. A message processing duration indicates the time period between the point in time when the message is delivered and 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 of Message Queue 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. The local time is 10:45:18 on April 12, 2022. In this case, the earliest message traces that you can query 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 the instance, you can upgrade the configuration of the instance to enable the message trace feature. For more information, see Upgrade the configuration of an instance.

Prerequisites

  • The message trace feature is enabled for the instance.
  • You sent a message to the Message Queue for RabbitMQ instance or consumed a message from the Message Queue for RabbitMQ instance.

Procedure

  1. Log on to the Message Queue for RabbitMQ console.
  2. In the Resource Distribution section of the Overview page, select the region where your instance is located.
  3. On the Instances page, click the name of your instance.
  4. In the left-side navigation pane, click Message Tracing.
  5. 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, specify a time range, 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, specify a time range, and then click Query.
    • 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, specify a time range, and then click Query.
  6. 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
    Basic Information 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 was produced by the client arrived at the Message Queue for RabbitMQ instance.
    Exchange The exchange to which the message that was produced by the client was sent in the Message Queue for RabbitMQ instance.
    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 message producer sent the message to the Message Queue for RabbitMQ instance.
    Result of Entering Queue None The name of the queue to which the message was delivered in the Message Queue for RabbitMQ instance.
    Delivery Details (queue) 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 Message Queue for RabbitMQ instance.
    Consumption Method The request method that was used when the message was consumed. For information about consumption methods, see Peak TPS in Billable items.
    autoAck Indicates whether an ACK was automatically sent after the message was consumed.
    deliveryTag The ordinal number that was used for the message delivery. An ordinal number is automatically generated when the Message Queue for RabbitMQ instance pushes a message to the consumer.
    consumerTag The unique identifier of the consumer client. The identifier can be specified in the consumer client code of the Message Queue for RabbitMQ instance, or can be automatically generated by the Message Queue 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.