Queries messages of a specified topic within a specified time range and writes the query results to a report.

You can call this operation to obtain online message statistics corresponding to specified topics, and query the number of messages written or transactions per second (TPS) curve within a specified period of time as needed.

Note If the message volume is small and messages are distributed unevenly, the TPS curve may be flat. We recommend that you query the total number of messages written.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes OnsTrendTopicInputTps

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

BeginTime Long Yes 1570852800000

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

EndTime Long Yes 1570868400000

The end of the time range to query. Unit: milliseconds.

InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance corresponding to the topic.

Topic String Yes test

The name of the topic that you want to query.

Type Integer Yes 0

The type of statistics that you want to query. Valid values:

  • 0: queries the number of written messages for the specified topic within a specified period of time.
  • 1: queries the TPS curve within a specified period of time.
Period Long No 10

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

Response parameters

Parameter Type Example Description
Data Struct

The returned data set.

Records Array

The data set that includes more detailed information.

StatsDataDo
X Long 1570852800000

The X axis. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC.

Y Float 0

The Y axis. It represents the TPS or the message production volume.

Title String MQ_INST_111111111111_DOxxxxxx%test total incoming volume trend

The name of the table that lists the historical message production TPS or volume in the specified time range.

XUnit String time

The time in the X axis. The time is displayed in the UNIX timestamp format. Unit: milliseconds.

YUnit String msg

The unit of the Y axis.

RequestId String E213AD8A-0730-4B3D-A35A-340DA47DBB2F

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/? Action=OnsTrendTopicInputTps
&BeginTime=1570852800000
&EndTime=1570868400000
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&Topic=test
&Type=0
&<Common request parameters>

Sample success responses

XML format

<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 total incoming volume trend chart</Title>
  </Data>
  <RequestId>E213AD8A-0730-4B3D-A35A-340DA47DBB2F</RequestId>
</OnsTrendTopicInputTpsResponse>

JSON format

{
    "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 total incoming volume trend chart"
    },
    "RequestId": "E213AD8A-0730-4B3D-A35A-340DA47DBB2F"
}

Error codes

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