Collect statistics on message production by Topic

Last Updated: Jan 30, 2018

OnsTrendTopicInputTps interface queries report data of message input for the specified Topic within a period of time.

Usage

This interface can be used for retrieving Topic message data in online environment. Depending on the type, you can query the Topic input amount in a specified time range, or you can query the TPS data in that time range.

If the application party has a small number of messages which are not evenly distributed, then TPS query may lead to scarce result. Instead, Total query is recommended.

Request parameters

Name

Type

Required

Description

OnsRegionId

String

Yes

The region where the queried MQ is currently located. It can be obtained through the OnsRegionList method.

OnsPlatform

String

No

The source of the request, which by default is POP platform.

PreventCache

Long

Yes

It’s used for CSRF verification. Set it to the current system time.

Topic

String

Yes

The name of the Topic to be queried

BeginTime

Long

Yes

The start time stamp in milliseconds of the query range

EndTime

Long

Yes

The end time stamp in milliseconds of the query range

Period

Long

Yes

A sampling cycle in minutes, which can be 1, 5, or 10.

Type

Integer

Yes

The query type (0 for total, and 1 for TPS)

Response parameters

Name

Type

Description

RequestId

String

A public parameter unique for each request

HelpUrl

String

A help link

data

Data

A data set

Data set definition

Name

Type

Description

Title

String

The table name

Records

List(StatsDataDo)

Information of a collection point

StatsDataDo data set definition

Name

Type

Description

X

Long

The horizontal axis with time stamps in milliseconds

Y

Float

The vertical axis for the data (TPS or total)

Related APIs

OnsTrendGroupOutputTps: queries the statistics of the message consumption of a CID

Example

publicstaticvoid main(String[]args){

String regionId ="cn-hangzhou";

String accessKey ="XXXXXXXXXXXXXXXXX";

String secretKey ="XXXXXXXXXXXXXXXXX";

String endPointName ="cn-hangzhou";

String productName ="Ons";

String domain ="ons.cn-hangzhou.aliyuncs.com";

/**

*Select Region based on the region you will access, and set the corresponding access point.