All Products
Search
Document Center

ApsaraMQ for RocketMQ:OnsTrendTopicInputTps

Last Updated:Aug 28, 2026

Queries the statistics about messages that are published to a topic within a period of time.

Operation description

Note

API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.

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.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

mq:QueryTrendTopicInputTps

get

Topic

acs:mq:{#regionId}:{#accountId}:{#TopicName}

Topic

acs:mq:{#regionId}:{#accountId}:{#InstanceId}%{#TopicName}

None
  • mq:OnsInstanceBaseInfo

Request parameters

Parameter

Type

Required

Description

Example

Topic

string

Yes

The name of the topic that you want to query.

test

BeginTime

integer

Yes

The timestamp that indicates the beginning of the time range to query. Unit: milliseconds.

1570852800000

EndTime

integer

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: the number of messages that are published to the topic during each sampling period.

  • 1: the TPS for message publishing in the topic during each sampling period.

0

InstanceId

string

No

The ID of the instance to which the topic you want to query belongs.

MQ_INST_111111111111_DOxxxxxx

Period

integer

No

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

10

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request. This parameter is a common parameter. Each request has a unique ID. You can use the ID to troubleshoot issues.

E213AD8A-0730-4B3D-A35A-340DA47D****

Data

object

The data returned.

Records

object

StatsDataDo

array<object>

The data set returned based on sampling period.

object

Y

number

The Y axis. This parameter indicates the TPS for message publishing or the number of messages that are published.

0

X

integer

The X axis. The value of this parameter is a UNIX timestamp in milliseconds.

1570852800000

XUnit

string

The unit of the timestamp.

ms

YUnit

string

The unit of the Y axis.

msg

Title

string

The name of the table.

TopicXXX Send Trend Chart

Examples

Success response

JSON format

{
  "RequestId": "E213AD8A-0730-4B3D-A35A-340DA47D****",
  "Data": {
    "Records": {
      "StatsDataDo": [
        {
          "Y": 0,
          "X": 1570852800000
        }
      ]
    },
    "XUnit": "ms",
    "YUnit": "msg",
    "Title": "TopicXXX  Send Trend Chart"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.