Queries the statistics on message consumption by consumers in a specified group within a specified time range.

Note

You can call this operation to query the following statistics that are collected in the production environment:

  • The number of messages that are consumed during each sampling period
  • The transactions per second (TPS) for message consumption during each sampling period
Note If your application publishes a small number of messages and does not publish messages at a specific interval, we recommend that you query the number of messages that are consumed during each sampling period because the statistics of TPS may not show a clear change trend.

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

OnsTrendGroupOutputTps

mq:QueryInstanceBaseInfo

mq:QueryTrendGroupOutputTps

acs:mq:*:*:{instanceId}%{groupId}

acs:mq:*:*:{groupId}

Request parameters

Parameter Type Required Example Description
Action String Yes OnsTrendGroupOutputTps

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

GroupId String Yes GID_test

The ID of the consumer group that you want to query.

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:

  • 0: the number of messages that are consumed during each sampling period.
  • 1: the TPS for message consumption during each sampling period.
InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance which contains the specified consumer group.

Period Long No 10

The sampling period. Unit: minutes. Valid values: 1, 5, and 10.

Response parameters

Parameter Type Example Description
RequestId String CE57AEDC-8FD2-43ED-8E3B-1F878077****

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 sampling period.

StatsDataDo
Y Float 0

Indicates the TPS for message consumption or the number of messages that are consumed.

X Long 1570867800000

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@MQ_INST_111111111111_DOxxxxxx%GID_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=OnsTrendGroupOutputTps
&BeginTime=1570852800000
&EndTime=1570868400000
&GroupId=GID_test
&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

<OnsTrendGroupOutputTpsResponse>
<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>1570855200000</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_INST_111111111111_DOxxxxxx%GID_test trend of received messages</Title>
</Data>
<RequestId>CE57AEDC-8FD2-43ED-8E3B-1F878077****</RequestId>
</OnsTrendGroupOutputTpsResponse>

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" : 1570855200000
      }, {
        "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@MQ_INST_111111111111_DOxxxxxx%GID_test trend of received messages"
  },
  "RequestId" : "CE57AEDC-8FD2-43ED-8E3B-1F878077****"
}

Error codes

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

View the statistics of message consumption in the console

In the Message Queue for Apache RocketMQ console, you can view the statistics on message consumption by consumers in a consumer group. For more information, see Dashboard.