All Products
Search
Document Center

Application Real-Time Monitoring Service:QueryMetric

Last Updated:Aug 27, 2026

Queries a metric.

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

xtrace:SearchTrace

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

IntervalInSec

integer

No

The time interval at which you want to query metric data. Unit: milliseconds. Minimum value: 60000.

Note

If you set this parameter to 2147483647, all data in the specified time interval is returned.

100000

StartTime

integer

Yes

The beginning of the time range to query. The value is a timestamp that is accurate to milliseconds.

Note

The value of this parameter is of the LONG type. Precision loss may occur during serialization or deserialization. The value must be less than or equal to 9007199254740991.

1575561600000

EndTime

integer

Yes

The end of the time range to query. The value is a timestamp that is accurate to milliseconds.

Note

The value of this parameter is of the LONG type. Precision loss may occur during serialization or deserialization. The value must be less than or equal to 9007199254740991.

1575622455686

OrderBy

string

No

The field based on which you want to sort the returned entries.

count

Limit

integer

No

The maximum number of entries that you want to return.

100

Metric

string

Yes

The name of the metric. Valid values:

  • appstat.incall: trace statistics

  • appstat.sql: SQL statistics

appstat.incall

Order

string

No

The order in which you want to sort the returned entries. Valid values:

  • ASC: ascending order

  • DESC: descending order

ASC

ProxyUserId

string

No

The ID of the proxy user.

testefgag12

Filters

array<object>

No

The filter conditions.

object

No

The filter conditions.

Key

string

No

The key of the field that you want to use to filter the returned entries.

service

Value

string

No

The value of the field that you want to use to filter the returned entries.

service-test

Dimensions

array

No

The dimensions of the metric that you want to query.

RT

string

No

The dimensions of the metric that you want to query.

pid

Measures

array

Yes

The measures of the metric that you want to query.

count

string

No

If you set the Metric parameter to appstat.incall, the Measures parameter has the following valid values:

  • rt: response time

  • count: total number of records that you want to return

  • error: number of errors

  • exception: exception

  • errorrate: error rate

  • qps: number of requests per second

If you set the Metric parameter to appstat.sql, the Measures parameter has the following valid values:

  • rt: response time

  • count: total number of records that you want to return

  • error: number of errors

  • slowcount: number of slow calls

rt

Response elements

Element

Type

Description

Example

object

Data

string

The returned statistics.

{ "Data": "{\"data\":[{\"date\":1583686800000,\"count\":0,\"rt\":0,\"rpc\":\"childSpan3\"}]}}

RequestId

string

The ID of the request.

1E2B6A4C-6B83-4062-8B6F-AEEC1F******

Examples

Success response

JSON format

{
  "Data": "{ \"Data\": \"{\\\"data\\\":[{\\\"date\\\":1583686800000,\\\"count\\\":0,\\\"rt\\\":0,\\\"rpc\\\":\\\"childSpan3\\\"}]}}",
  "RequestId": "1E2B6A4C-6B83-4062-8B6F-AEEC1F******"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.