All Products
Search
Document Center

ApsaraMQ for RocketMQ:Message trace

Last Updated:Jun 20, 2026

In distributed applications, ApsaraMQ for RocketMQ is a key service that provides asynchronous decoupling. The message trace data from the service links upstream and downstream business information to help you troubleshoot exceptions and locate problems. This topic describes the use cases of message traces, the trace parameters defined by ApsaraMQ for RocketMQ, and how to view message traces.

Use cases

ApsaraMQ for RocketMQ defines key data points in the message lifecycle as trace parameters and provides a visual query tool. Message traces allow you to quickly understand your business process status and identify exceptions.

Typical use cases for message traces include the following:

  • Scenario 1: Check whether a message was sent or consumed successfully.

  • Scenario 2: Check whether a scheduled and delayed message has been delivered.

  • Scenario 3: Check whether a transactional message has been committed or rolled back.

  • Scenario 4: View producer and consumer identity and machine information to investigate issues.

Trace parameters

The following table describes the trace parameters provided by ApsaraMQ for RocketMQ.

Category

Parameter

Description

Producer

Producer information

The account or AccessKey ID used by the message producer.

Hostname

The hostname of the producer client's machine.

Sent at

The time the producer sent the message.

Arrival at

The time the message was stored on the ApsaraMQ for RocketMQ server.

Sending result

The result of the message send operation. Valid values:

  • Sent

  • Failed

Basic message information

Message type

Message ID

A globally unique message identifier, automatically generated by ApsaraMQ for RocketMQ.

Topic

The topic to which the message belongs.

Message key

A business key set by the producer to uniquely identify a business logic.

Message tag

A tag used to filter messages within a topic.

Ordered messages

MessageGroup

The producer-defined MessageGroup for an ordered message. Messages in the same MessageGroup are processed in first-in, first-out (FIFO) order.

Transactional messages

Check callback time

The time of the transaction status check callback for a half message.

Committed at

The time the server committed the transactional message.

Rolled back at

The time the transactional message was rolled back.

Scheduled messages

Preset delay time

The scheduled delivery time for the message.

Consumer

Consumption result

The result of one consumption attempt. Valid values:

  • Consumed

  • Failed

  • No Response

Consumer information

The ApsaraMQ for RocketMQ account or AccessKey ID that the consumer uses to subscribe to messages.

Hostname

The hostname of the consumer client's machine.

Ordered delivery

Indicates whether ordered consumption is enabled for the consumer's group.

Delivery time

The time the ApsaraMQ for RocketMQ server delivered the message to the consumer.

Response time

The time the ApsaraMQ for RocketMQ server received the consumption result from the consumer.

invisibleDuration

The message invisibility duration specified by the SimpleConsumer. For more information, see SimpleConsumer consumption retry policy.

Change invisible duration

The time the SimpleConsumer called the ChangeInvisibleDuration operation.

Dead-letter time

The time a message was sent to the dead-letter queue after consumption failed.

Limitations

The message trace feature is disabled by default for clients using RocketMQ 4.x/3.x SDKs. To query message traces in the console, you must enable this feature in your code. Configure the following settings:

  • Producer

    producer.setAccessChannel(AccessChannel.CLOUD);
  • Consumer

    consumer.setAccessChannel(AccessChannel.CLOUD);

Billing

  • For subscription and pay-as-you-go instances, message tracing is enabled by default and is free.

  • For serverless instances, you can manually enable or disable message tracing. For more information, see Enable or disable message tracing for a serverless instance.

    If you enable message tracing for a serverless instance, you are charged based on the number of message traces generated. For billing details, see Message trace fees.

Message trace retention period

  • For subscription and pay-as-you-go instances, message traces are stored for 3 days.

  • For serverless instances, message traces are stored for 14 days.

Query methods for message traces

ApsaraMQ for RocketMQ supports the following query methods:

  • Query by message ID: Performs an exact match. This fast and accurate method is recommended.

  • Query by message key: This method performs a fuzzy search that returns up to 1,000 traces. Use this method only if you have not recorded the message ID but have set a distinct message key.

  • Query by topic: Performs a range query. This method is suitable for low-volume scenarios where the message ID or message key is unknown. It is not recommended for general use because a time range may contain many non-distinct messages.

Enable or disable message tracing

Note
  • If you disable message tracing, trace data for the serverless instance cannot be stored or queried, and the message trace query option will not appear in the console.

  • If you enable message tracing, you are charged for the message traces generated by the serverless instance. For more information, see Message trace fees.

  1. Log on to the ApsaraMQ for RocketMQ console. In the left-side navigation pane, click Instances.

  2. In the top navigation bar, select a region, such as China (Hangzhou). On the Instances page, click the name of the instance that you want to manage.

  3. On the Instance Details page, click the Basic Information tab. Then, click Enable or Disable next to the Message Trace parameter.

  4. In the dialog box that appears, click OK.

Query message traces

  1. Log on to the ApsaraMQ for RocketMQ console. In the left-side navigation pane, click Instances.

  2. In the top navigation bar, select a region, such as China (Hangzhou). On the Instances page, click the name of the instance that you want to manage.

  3. In the left-side navigation pane, click Message Traces. On the Message Traces page, select a query method, enter the conditions, and then click Query.

    The results are displayed in a table that includes columns such as Message ID, Topic, Tag, Message Key, and Creation Time. In the Actions column, click Message Traces to view the trace details for the corresponding message.

  4. Find the target message in the query results and click Message Trace in the Actions column. A panel appears where you can view detailed message information.

    The message trace panel displays the message's complete lifecycle from production to consumption, divided into three areas: The Producer area shows the message source, producer information, hostname, sent time, server arrival time, and sending result. The MQ Server area shows the message type, message ID, topic, message keys, and tag. The Consumer area shows the group ID, consumption statistics (total and failed attempts), and the consumption status of each consumer group.

  5. If the message was consumed successfully, click the group ID on the Consumer card to view detailed consumption information. Click Export Image to generate an image of the current message trace details.

    The message trace details consist of three panels: The Producer panel displays the sent time, server arrival time, and sending result. The MQ Server panel displays the message type, message ID, topic, and tag. The consumer group panel (for example, test_group1), when expanded, shows the number of deliveries, delivery result, ordered delivery status, delivery time, and response time.

Related topics

You can also manage message traces by calling the following API operations: