You need to enable JavaScript to run this app.
导航
QueryMessageTraceByMessageId - 查询消息轨迹
最近更新时间:2025.04.02 14:59:01首次发布时间:2025.04.02 14:18:58
我的收藏
有用
有用
无用
无用

调用 QueryMessageTraceByMessageId 接口查询消息轨迹。

调试

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

参数
类型
是否必填
示例值
描述
Action
String

QueryMessageTraceByMessageId

要执行的操作,取值:QueryMessageTraceByMessageId。

Version
String

2023-01-01

API的版本,取值:2023-01-01。

Topic
String

topic-test

业务消息的 topic 名称。

MessageId
String

FDBDDC005EA10352000000000AFEEF9A63AF18B4AAC25A****9B0000

消息 ID。

QueryStartTimestamp
Long

1739603639

业务消息的起始时间戳,单位秒,如业务消息是 08 秒生产的,那么查询时需要指定 08 秒以前的时间。

QueryEndTimestamp
Long

1739862839

消息查询的最后时间戳,单位秒,与 QueryStartTimestamp 参数配合使用,用来控制消息查询的时间范围。

NeedProduceTraceInfo
Boolean

true

是否需要生产者的消息轨迹。

MessageBornTimestamp
Long

1739862800

消息产生的时间戳,单位秒。

InstanceId
String

rocketmq-cnoed031c6f3****

实例 ID。

返回参数

下表仅列出本接口特有的返回参数。更多信息请参见返回结构

参数
类型
示例值
描述
ProducerTraceInfo
Array of Object

详情请参见返回示例

生产者消息轨迹详情。

ConsumerTraceInfos
Array of Object

详情请参见返回示例

消费者轨迹详情。

请求示例

POST /?Action=QueryMessageTraceByMessageId&Version=2023-01-01 HTTP/1.1
Host: volcengineapi-boe-stable.byted.org
Content-Type: application/json; charset=UTF-8
X-Date: 20250218T081711Z
X-Content-Sha256: 287e874e******d653b44d21e
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20250218/cn-beijing/RocketMQ/request, SignedHeaders=host;x-content-sha256;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f

{
  "Topic": "topic-test",
  "MessageId": "FDBDDC005EA10352000000000AFEEF9A63AF18B4AAC25AD0****0000",
  "QueryStartTimestamp": 1739603639,
  "QueryEndTimestamp": 1739862839,
  "MessageBornTimestamp": 1739862800,
  "NeedProduceTraceInfo": true,
  "InstanceId": "rocketmq-cnoed031c6f3****"
}

返回示例

{
  "ResponseMetadata": {
    "RequestId": "202502181617272101231650877C05B3",
    "Action": "QueryMessageTraceByMessageId",
    "Version": "2023-01-01",
    "Service": "RocketMQ",
    "Region": "cn-beijing"
  },
  "Result": {
    "ProducerTraceInfo": [
      {
        "MessageBornHost": "127.0.0.1:2****",
        "MessageBornTimestamp": 173986****,
        "SendCostTimeMs": 3,
        "SendStatus": "SEND_OK"
      }
    ],
    "ConsumerTraceInfos": [
      {
        "ConsumerHost": "10.200.2xx.1xx@9****",
        "StartProcessTimestamp": 1739862800,
        "EndProcessTimestamp": 1739862801,
        "ProcessCostTimeMs": 3,
        "ReconsumeTimes": 2,
        "GroupName": "group-test",
        "ConsumeStatus": "CONSUME_SUCCESS",
        "ConsumeSuccess": true
      }
    ]
  }
}

错误码

下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。

状态码
错误码
错误信息
说明
400
InvalidPara

The specified parameter is not valid.

参数值无效。

400
TopicNotExist

The specified topic does not exist.

Topic 不存在。

400
OperationDenied.InvalidRequest

The request that you specified is not valid.

请求异常,请检查后重试。

404
InvalidMessageId.NotFound

The message ID does not exist in the instance %s.

Message ID不存在。

500
ServerInternalError

The request failed due to some unknown error, exception or failure.

服务内部错误。

503
ServiceUnavailable

The request failed due to a temporary failure of the server.

当前服务暂时不可用。