Queries message tracing results by specifying the ID of a tracing task.

Usage notes

  • If you have created a tracing task based on a message ID or message key and have obtained the ID of the tracing task, you can call this operation to query the detailed tracing results based on the task ID. You can create a tracing task by calling the OnsTraceQueryByMsgId or OnsTraceQueryByMsgKey operation. The QueryId response parameter indicates the tracing task ID to be specified for the OnsTraceGetResult operation.
  • A message tracing task is time-consuming. If you query the results by calling this operation immediately after you create a tracing task, the results may be empty. If this occurs, we recommend that you wait for a while and try again.

QPS limit

The queries-per-second (QPS) limit on this operation is 10 per user. Throttling is triggered when the number of calls to this operation per second exceeds the QPS limit. Throttling may affect your business. Therefore, call this operation based on your needs. For more information, see QPS limits.

Authorization information

Alibaba Cloud accounts and RAM users can call this operation without the need to be authorized. For more information, see Policies and examples.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes OnsTraceGetResult

The operation that you want to perform. Set the value to OnsTraceGetResult.

QueryId String Yes 272967562652883649157096685****

The ID of the tracing task for which you want to query the tracing results.

Response parameters

Parameter Type Example Description
TraceData Struct

The detailed results of the tracing task.

CreateTime Long 1570966857000

The time when the tracing task was created.

InstanceId String MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance.

MsgId String 1E05791C117818B4AAC23B1BB0CE****

The ID of the message that corresponds to the tracing task.

MsgKey String ORDERID_100

The key of the message that corresponds to the tracing task.

QueryId String 272967562652883649157096685****

The ID of the tracing task.

Status String finish

The status of the tracing task. Valid values:

  • finish: The task is completed.
  • working: The task is in progress.
  • removed: The task is deleted.
Topic String test

The topic that corresponds to the tracing task.

TraceList Array of TraceMapDo

A returned list of matched traces for the tracing task.

TraceMapDo
BornHost String 30.5.**. **

The address of the producer instance that produced the message that corresponds to the tracing task.

CostTime Integer 24

The amount of time taken to send the message. Unit: milliseconds.

MsgId String 0BC1F01800002A9F000000531246****

The ID of the message that corresponds to the tracing task.

MsgKey String ORDERID_100

The key of the message that corresponds to the tracing task.

PubGroupName String GID_test

The group ID configured on the producer instance that produced the message.

PubTime Long 1570850870478

The time when the message was sent.

Status String SEND_SUCCESS

The sending status of the message that corresponds to the tracing task. 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 has not been committed.
  • SEND_DELAY: The message is a scheduled or delayed message and has not reached the delivery time.
SubList Array of SubMapDo

A returned list of consumption traces of the message.

SubMapDo
ClientList Array of SubClientInfoDo

Detailed consumption records of the consumer instance that corresponds to the group ID.

SubClientInfoDo
ClientHost String 30.5.**. **

The address of the consumer instance that consumed the message.

CostTime Integer 43

The amount of time taken to consume the message. Unit: milliseconds.

ReconsumeTimes Integer 1

The number of message delivery rounds for the consumption.

Status String CONSUME_SUCCESS

The consumption status of the message. Valid values:

  • CONSUME_FAILED: The consumption failed.
  • CONSUME_SUCCESS: The consumption is successful.
  • CONSUME_NOT_RETURN: The consumption result has not been returned.
  • SEND_UNKNOWN: The message is a transactional message and has not been committed.
  • SEND_DELAY: The message is a scheduled or delayed message and has not reached the delivery time.
SubGroupName String GID_test

The group ID of the consumer instance that consumed the message.

SubTime Long 1570851590511

The timestamp that indicates when the consumption started.

FailCount Integer 0

The number of consumption failures of the group ID.

SubGroupName String GID_test

The group ID of the consumer instance that consumed the message.

SuccessCount Integer 1

The number of successful consumptions of the group ID.

Tag String TagA

The tag of the message.

Topic String test

The topic of the message.

UpdateTime Long 1570966877000

The time when the tracing task was last updated.

UserId String 27296756265288****

The ID of the user who queried traces of the message.

RequestId String 84EE24D2-851F-40D6-B99E-4D6AB909****

The ID of the request, which is a common parameter. Each request has a unique ID to facilitate troubleshooting and fault locating.

Examples

Sample requests

http(s)://ons.cn-hangzhou.aliyuncs.com/? Action=OnsTraceGetResult
&QueryId=272967562652883649157096685****
&<Common request parameters>

Sample success responses

XML format

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

JSON format

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

Error codes

For a list of error codes, visit the API Error Center.

Operations in the console

In addition to calling the OnsTraceGetResult operation, you can view the message tracing results in the Message Queue for Apache RocketMQ console. For more information, see Query a message trace.