Queries the statistics about messages that are published to a topic within a specific period of time.
Operation description
You can call this operation to query the statistics of messages that are published to a specific topic in a production environment. You can query the number of messages that are published to the topic or the transactions per second (TPS) for message publishing within a specified time range based on your business requirements.
If your application publishes a small number of messages and does not publish messages at specific intervals, we recommend that you query the number of messages that are published to the topic during each sampling period because the statistics of TPS may not show a clear change trend.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
mq:QueryTrendTopicInputTps | Read |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
Topic | string | Yes | The name of the topic that you want to query. | test |
BeginTime | long | Yes | The timestamp that indicates the beginning of the time range to query. Unit: milliseconds. | 1570852800000 |
EndTime | long | Yes | The timestamp that indicates the end of the time range to query. Unit: milliseconds. | 1570868400000 |
Type | integer | Yes | The type of information that you want to query. Valid values:
| 0 |
InstanceId | string | Yes | The ID of the instance to which the topic you want to query belongs. | MQ_INST_111111111111_DOxxxxxx |
Period | long | No | The sampling period. Unit: minutes. Valid values: 1, 5, and 10. | 10 |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "E213AD8A-0730-4B3D-A35A-340DA47D****",
"Data": {
"Records": {
"StatsDataDo": [
{
"Y": 0,
"X": 1570852800000
}
]
},
"XUnit": "time",
"YUnit": "msg",
"Title": "MQ_INST\\_111111111111\\_DOxxxxxx%test trend of received messages\n"
}
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|
Query the statistics about messages published to a topic in the console
You can view the statistics of the messages that are published to a topic in the ApsaraMQ for RocketMQ console.**** For more information, see Dashboard .