Domain name for API request: apm.intl.tencentcloudapi.com.
General interface to obtain metric data. Submit request parameters as needed and receive the corresponding metric data.
API call frequency limit: 20 requests/second, 1,200 requests/minute. Data point limit per single request: up to 1,440 data points.
General interface to obtain metric data usage: This API is used to query metric data flexibly. The query method of this API is similar to using the following SQL statement: SELECT {Metrics} FROM {ViewName} WHERE {Filters} GROUP BY {GroupBy}. Before initiating request, please confirm the following key parameters:
View (ViewName)
Determine the domain of the queried data.
For example: service_metric (service monitoring view), db_metric (database view). For views supported by APM, see metrics view (https://www.tencentcloud.com/document/product/248/101681?from_cn_redirect=1#069b06a9-2593-49db-b694-dea4200f3b19).
Metrics
Used to specify one or more metric items in the returned result.
For example: request_count (request count), duration_avg (avg duration), error_rate (error rate). For supported metrics about APM, see APM Protocol Standards. Each view (ViewName) supports an exclusive metric set.
Filters
Support filter criteria in the form of one or multiple Key-Value pairs.
For example: Only query a certain specific service with service.name = "order-service". Common dimensional and each view (ViewName) support exclusive dimensions, which can be used as keys in filter conditions. For details, refer to the APM metrics protocol standard (https://www.tencentcloud.com/document/product/248/101681?from_cn_redirect=1).
GroupBy (aggregation)
Support one or more aggregate dimensions, equivalent to SQL GROUP BY.
For example: Group by API name operation to view the performance of each API. Common dimensional and each view (ViewName) support exclusive dimensional, which can be used as aggregation dimension. For details, see APM protocol standards.
Granularity (Period)
This parameter determines whether time slice aggregation is required.
-Period = 1: Time series mode: In the returned result, aggregation is performed by time slice. The time series (TimeSerial) and data sequence (DataSerial) have a one-to-one correspondence, representing aggregation results for specific time slices. Time series mode is mainly used to show time trend charts.
-Period = 0: Summarize mode. In the returned result, the data sequence (DataSerial) only contains a unique value, representing the aggregated data for the entire time interval.
A maximum of 20 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: DescribeGeneralMetricData. |
| Version | Yes | String | Common Params. The value used for this API: 2021-06-22. |
| Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. |
| Metrics.N | Yes | Array of String | Metric name to be queried, which cannot be customized. (for details, see <https: 248="" intl.cloud.tencent.com="" document="" product="" 101681?from_cn_redirect="1">.). |
| InstanceId | Yes | String | Business system id. |
| ViewName | Yes | String | View name. the input cannot be customized. for details, see.. |
| Filters.N | Yes | Array of GeneralFilter | The dimension information to be filtered; different views have corresponding metric dimensions. (for details, see <https: 248="" intl.cloud.tencent.com="" document="" product="" 101681?from_cn_redirect="1">.). |
| GroupBy.N | No | Array of String | Aggregated dimension; different views have corresponding metric dimensions. (for details, see <https: 248="" intl.cloud.tencent.com="" document="" product="" 101681?from_cn_redirect="1">.). |
| StartTime | No | Integer | The timestamp of the start time, supporting the query of metric data within 30 days. (unit: seconds). |
| EndTime | No | Integer | The timestamp of the end time, supporting the query of metric data within 30 days. (unit: seconds). |
| Period | No | Integer | Whether to aggregate by a fixed time span: enter 1 for values of 1 and greater, and 0 if not filled in. -If 0 is filled in, it calculates the metric data from the start time to the cutoff time. - if 1 is filled in, the aggregation granularity will be selected according to the time span from the start time to the deadline:. -If the time span is (0,12) hours, it is aggregated by one-minute granularity. -If the time span is [12,48] hours, it is aggregated at a five-minute granularity. -If the time span is (48, +inf) hours, it is aggregated at an hourly granularity. |
| OrderBy | No | OrderBy | Sort query metrics. Key: enter the tencentcloud api metric name. for details, see . Value: specify the sorting method:. -Asc: sorts query metrics in ascending order. - desc: sort query metrics in descending order. |
| PageSize | No | Integer | Maximum number of queried metrics. currently, up to 50 data entries can be displayed. the value range for pagesize is 1-50. submit pagesize to show the limited number based on the value of pagesize. |
| Parameter Name | Type | Description |
|---|---|---|
| Records | Array of Line | Indicator result set. |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
Scenario description: View the total number of requests for each API for a period of time, or view indicators such as average response time, p99, maximum response time, and error rate.
Key configuration:
POST / HTTP/1.1
Host: apm.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeGeneralMetricData
<Common request parameters>
{
"InstanceId": "apm-instanceKey",
"ViewName": "service_metric",
"Metrics": [
"request_count"
],
"Filters": [
{
"Key": "span.kind",
"Value": "server"
},
{
"Key": "service.name",
"Value": "apm-test"
}
],
"GroupBy": [
"operation"
],
"StartTime": 1768377000,
"EndTime": 1768377900,
"Period": 0
}
{
"Response": {
"Records": [
{
"MetricName": "service_request_count_sum",
"MetricNameCN": "Total Number of Requests"
"Tags": [
{
"Key": "operation",
"Value": "GET /mall/test"
}
],
"TimeSerial": [],
"DataSerial": [
18
]
}
],
"RequestId": "bfcc1a20-b6ff-455b-8fab-1d9883f4f629"
}
}
Scenario description: View the traffic trend and time consumption trend of a certain service within a period of time. Usually used for frontend to draw a line chart.
Key configuration:
POST / HTTP/1.1
Host: apm.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeGeneralMetricData
<Common request parameters>
{
"InstanceId": "apm-instanceKey",
"ViewName": "service_metric",
"Metrics": [
"request_count"
],
"Filters": [
{
"Key": "span.kind",
"Value": "server"
},
{
"Key": "service.name",
"Value": "apm-test"
},
{
"Key": "operation",
"Value": "POST /mall/test"
}
],
"StartTime": 1768377000,
"EndTime": 1768377900,
"Period": 1
}
{
"Response": {
"Records": [
{
"MetricName": "service_request_count_sum",
"MetricName": "Total Number of Requests"
"Tags": [
{
"Key": "service.name",
"Value": "apm-test"
}
],
"TimeSerial": [
1768377000,
1768377060,
1768377120
],
"DataSerial": [
1,
null,
1
]
}
],
"RequestId": "4d62d7d5-e4b7-491b-874e-3563968f1626"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| FailedOperation | Operation failed. |
| FailedOperation.AppIdNotMatchInstanceInfo | The appid does not match the business system information. |
| FailedOperation.InstanceIdIsEmpty | Business system id is empty. |
| FailedOperation.InstanceNotFound | The apm business system does not exist. |
| FailedOperation.InvalidInstanceID | Invalid business system id. |
| FailedOperation.MetricFiltersLackParams | The metric data query lacks filter parameters in the query criteria. |
| FailedOperation.QueryTimeIntervalIsNotSupported | Query time range not supported. |
| FailedOperation.ViewNameNotExistOrIllegal | The view name does not exist or is invalid. |
| InvalidParameter.FiltersFieldsNotExistOrIllegal | The field in filters does not exist or is invalid. |
| InvalidParameter.GroupByFieldsNotExistOrIllegal | The field in groupby does not exist or is invalid. |
| InvalidParameter.MetricFiltersLackParams | The service.name field must exist in filters, otherwise an error will occur. |
| InvalidParameter.MetricsFieldNotExistOrIllegal | The field in metrics does not exist or is invalid. |
| InvalidParameter.MetricsFieldsNotAllowEmpty | Metrics cannot be empty. |
| InvalidParameter.PeriodIsIllegal | Period should not be empty, and can be 0 or 60. |
| InvalidParameter.QueryTimeIntervalIsNotSupported | Query time not supported. up to 30 days of recent data can be queried. |
| InvalidParameter.ViewNameNotExistOrIllegal | The view name does not exist or is invalid. |
文档反馈