Queries the statistics on message publishing to a specified topic within a specified time range.
Note
You can call this operation to query the statistics of messages that are published to a specified topic in the production environment. You can obtain the number of messages that are published to the topic or the transactions per second (TPS) for message publishing during each sampling period within a specified time range.
Request limit
Each Alibaba Cloud account can call this operation up to 15 times per minute. If the number of requests that you send to call this operation within one minute reaches the request limit, new requests fail. This may interrupt your business. For information about the request limit of each operation, see API request limits.
Authorization
By default, Alibaba Cloud accounts can call this operation. A Resource Access Management (RAM) user can call this operation only after the RAM user is granted the required permissions. The following table describes the permissions that must be granted to a RAM user to call this operation. For information about how to grant permissions, see Policies.
API |
Action |
Resource in an instance that uses a namespace |
Resource in an instance that does not use a namespace |
---|---|---|---|
OnsTrendTopicInputTps |
mq:QueryInstanceBaseInfo mq:QueryTrendTopicInputTps |
acs:mq:*:*:{instanceId}%{topic} |
acs:mq:*:*:{topic} |
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | OnsTrendTopicInputTps |
The operation that you want to perform. Set the value to OnsTrendTopicInputTps. |
Topic | String | Yes | test |
The name of the topic that you want to query. |
BeginTime | Long | Yes | 1570852800000 |
The beginning of the time range to query. The value is a UNIX timestamp representing the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC. |
EndTime | Long | Yes | 1570868400000 |
The end of the time range to query. The value is a UNIX timestamp representing the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC. |
Type | Integer | Yes | 0 |
The type of information that you want to query. Valid values:
|
InstanceId | String | Yes | MQ_INST_111111111111_DOxxxxxx |
The ID of the Message Queue for Apache RocketMQ instance which contains the topic you want to query. |
Period | Long | No | 10 |
The sampling period. Unit: minutes. Valid values: 1, 5, and 10. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | E213AD8A-0730-4B3D-A35A-340DA47D**** |
The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID. |
Data | Object |
The data that is returned. |
|
Records | Array of StatsDataDo |
The data set that is returned based on each sampling period. |
|
StatsDataDo | |||
Y | Float | 0 |
Indicates the TPS for message publishing or the number of messages that are published to the topic. |
X | Long | 1570852800000 |
Indicates the timestamp. The value is a UNIX timestamp representing the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC. |
XUnit | String | time |
The unit of the timestamp. Unit: milliseconds. |
YUnit | String | msg |
The unit of the value of the Y parameter. |
Title | String | MQ_INST_111111111111_DOxxxxxx%test trend of received messages |
The name of the table that stores the data. |
Examples
Sample requests
http(s)://ons.cn-hangzhou.aliyuncs.com/?Action=OnsTrendTopicInputTps
&BeginTime=1570852800000
&EndTime=1570868400000
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&Topic=test
&Type=0
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<OnsTrendTopicInputTpsResponse>
<Data>
<Records>
<StatsDataDo>
<Y>0</Y>
<X>1570852800000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570853400000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570854000000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570854600000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570860600000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570861200000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570861800000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570862400000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570863000000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570863600000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570864200000</X>
</StatsDataDo>
<StatsDataDo>
<Y>1</Y>
<X>1570864800000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570865400000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570866000000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570866600000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570867200000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570867800000</X>
</StatsDataDo>
<StatsDataDo>
<Y>0</Y>
<X>1570868400000</X>
</StatsDataDo>
</Records>
<XUnit>time</XUnit>
<YUnit>msg</YUnit>
<Title>MQ_INST_111111111111_DOxxxxxx%test-mq_topic trend of received messages</Title>
</Data>
<RequestId>E213AD8A-0730-4B3D-A35A-340DA47D****</RequestId>
</OnsTrendTopicInputTpsResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"Data" : {
"Records" : {
"StatsDataDo" : [ {
"Y" : 0,
"X" : 1570852800000
}, {
"Y" : 0,
"X" : 1570853400000
}, {
"Y" : 0,
"X" : 1570854000000
}, {
"Y" : 0,
"X" : 1570854600000
}, {
"Y" : 0,
"X" : 1570860600000
}, {
"Y" : 0,
"X" : 1570861200000
}, {
"Y" : 0,
"X" : 1570861800000
}, {
"Y" : 0,
"X" : 1570862400000
}, {
"Y" : 0,
"X" : 1570863000000
}, {
"Y" : 0,
"X" : 1570863600000
}, {
"Y" : 0,
"X" : 1570864200000
}, {
"Y" : 1,
"X" : 1570864800000
}, {
"Y" : 0,
"X" : 1570865400000
}, {
"Y" : 0,
"X" : 1570866000000
}, {
"Y" : 0,
"X" : 1570866600000
}, {
"Y" : 0,
"X" : 1570867200000
}, {
"Y" : 0,
"X" : 1570867800000
}, {
"Y" : 0,
"X" : 1570868400000
} ]
},
"XUnit" : "time",
"YUnit" : "msg",
"Title": "MQ_INST_111111111111_DOxxxxxx%test trend of received messages"
},
"RequestId" : "E213AD8A-0730-4B3D-A35A-340DA47D****"
}
Error codes
For a list of error codes, visit the API Error Center.
View statistics of messages in the console
In the Message Queue for Apache RocketMQ console, you can view the statistics of the messages that are published to a topic. For more information, see Dashboard.