All Products
Search
Document Center

ApsaraMQ for RocketMQ:OnsTraceGetResult

Last Updated:May 24, 2024

The tracing results are queried by specifying the ID of a trace query task.

Operation description

Note API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.
  • Before you call this operation to query the details of the trace of a message, you must create a task to query the trace of the message based on the message ID or message key and obtain the task ID. Then, you can call this operation to query the details of the message trace based on the task ID. You can call the OnsTraceQueryByMsgId operation or the OnsTraceQueryByMsgKey operation to create a task to query the trace of the message and obtain the task ID from the QueryId response parameter.
  • A trace query task is time-consuming. If you call this operation to query the details immediately after you create a trace query task, the results may be empty. In this case, we recommend that you try again later.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
QueryIdstringYes

The ID of the task that was created to query the trace of the message.

272967562652883649157096685****
InstanceIdstringNo

The ID of the instance to which the message you want to query belongs.

MQ_INST_111111111111_DOxxxxxx
TopicstringNo

The topic to which the message belongs.

test

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request. This parameter is a common parameter. Each request has a unique ID. You can use this ID to troubleshoot issues.

84EE24D2-851F-40D6-B99E-4D6AB909****
TraceDataobject

The details of the message trace.

Statusstring

The status of the task. Valid values:

  • finish: The task is complete.
  • working: The task is in progress.
  • removed: The task is deleted.
finish
MsgKeystring

The key of the message that is queried.

ORDERID_100
UpdateTimelong

The most recent point in time when the task was updated.

1570966877000
CreateTimelong

The point in time when the task was created.

1570966857000
Topicstring

The topic in which the message is stored.

test
UserIdstring

The ID of the user who created the task.

27296756265288****
InstanceIdstring

The ID of the instance

MQ_INST_111111111111_DOxxxxxx
MsgIdstring

The ID of the message that is queried.

1E05791C117818B4AAC23B1BB0CE****
TraceListobject []

The details of the message trace.

Statusstring

Indicates whether the message is sent. Valid values:

  • SEND_SUCCESS: The message is sent.
  • SEND_FAILED: The message failed to be sent.
  • SEND_ROLLBACK: The message is a transactional message and is rolled back.
  • SEND_UNKNOWN: The message is a transactional message and is not committed.
  • SEND_DELAY: The message is a scheduled or delayed message and is waiting to be consumed at the specified point in time.
SEND_SUCCESS
MsgKeystring

The key of the message.

ORDERID_100
PubTimelong

The point in time when the message was sent.

1570850870478
SubListobject []

The consumption traces of the message.

ClientListobject []

The information about message consumption by consumers in the group.

Statusstring

Indicates whether the message is consumed. Valid values:

  • CONSUME_FAILED: The message failed to be consumed.
  • CONSUME_SUCCESS: The message is consumed.
  • CONSUME_NOT_RETURN: No responses are returned.
  • SEND_UNKNOWN: The message is a transactional message and is not committed.
  • SEND_DELAY: The message is a scheduled or delayed message and is waiting to be consumed at the specified point in time.
CONSUME_SUCCESS
SubTimelong

The earliest point in time when the message was consumed.

1570851590511
ReconsumeTimesinteger

The number of attempts that the ApsaraMQ for RocketMQ broker tried to send the message to the consumer.

1
SubGroupNamestring

The ID of the group that contains the consumer.

GID_test
ClientHoststring

The address of the consumer.

30.5.**.**
CostTimeinteger

The period of time that the system took to consume the message. Unit: milliseconds.

43
FailCountinteger

The number of consumption failures.

0
SubGroupNamestring

The ID of the consumer group.

GID_test
SuccessCountinteger

The number of successful consumptions.

1
Topicstring

The topic to which the message belongs.

test
CostTimeinteger

The period of time that the system took to send the message. Unit: milliseconds.

24
Tagstring

The tag of the message.

TagA
MsgIdstring

The ID of the message.

0BC1F01800002A9F000000531246****
PubGroupNamestring

The ID of the group that contains the producer.

GID_test
BornHoststring

The address of the producer that generated the message.

30.5.**.**
QueryIdstring

The ID of the task.

272967562652883649157096685****

Examples

Sample success responses

JSONformat

{
  "RequestId": "84EE24D2-851F-40D6-B99E-4D6AB909****",
  "TraceData": {
    "Status": "finish",
    "MsgKey": "ORDERID_100",
    "UpdateTime": 1570966877000,
    "CreateTime": 1570966857000,
    "Topic": "test",
    "UserId": "27296756265288****",
    "InstanceId": "MQ_INST_111111111111_DOxxxxxx",
    "MsgId": "1E05791C117818B4AAC23B1BB0CE****",
    "TraceList": {
      "TraceMapDo": [
        {
          "Status": "SEND_SUCCESS",
          "MsgKey": "ORDERID_100",
          "PubTime": 1570850870478,
          "SubList": {
            "SubMapDo": [
              {
                "ClientList": {
                  "SubClientInfoDo": [
                    {
                      "Status": "CONSUME_SUCCESS",
                      "SubTime": 1570851590511,
                      "ReconsumeTimes": 1,
                      "SubGroupName": "GID_test",
                      "ClientHost": "30.5.**.**",
                      "CostTime": 43
                    }
                  ]
                },
                "FailCount": 0,
                "SubGroupName": "GID_test",
                "SuccessCount": 1
              }
            ]
          },
          "Topic": "test",
          "CostTime": 24,
          "Tag": "TagA",
          "MsgId": "0BC1F01800002A9F000000531246****",
          "PubGroupName": "GID_test",
          "BornHost": "30.5.**.**"
        }
      ]
    },
    "QueryId": "272967562652883649157096685****"
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-03-19The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: InstanceId
    Added Input Parameters: Topic

Query the trace of a message in the console

You can also query the trace of a message in the ApsaraMQ for RocketMQ console.**** For more information, see Query a message trace.