tencent cloud

DescribeMetricRecords
最后更新时间:2025-11-14 16:37:49
DescribeMetricRecords
最后更新时间: 2025-11-14 16:37:49

1. API Description

Domain name for API request: apm.intl.tencentcloudapi.com.

This API is used to query metric list. To query metrics, it is recommended to use the DescribeGeneralMetricData API.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

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: DescribeMetricRecords.
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 QueryMetricItem Metric list.
InstanceId Yes String Business system id.
StartTime Yes Integer Start time (unit: sec).
EndTime Yes Integer End time (unit: seconds).
GroupBy.N Yes Array of String Aggregation dimension.
Filters.N No Array of Filter Filter criteria.
OrFilters.N No Array of Filter Or filter criteria.
OrderBy No OrderBy Sort
.
The currently supported keys are:.

-StartTime (start time).
-EndTime (end time).
-Duration (response time).

The currently supported values are:.

- desc: sort in descending order.
-Asc - ascending order.
BusinessName No String The service name of the business itself. console users should fill in taw.
Type No String Special handling of query results.
Limit No Integer Size per page, defaults to 1,000, valid value range is 0 – 1,000.
Offset No Integer Paging starting point.
PageIndex No Integer Page number.
PageSize No Integer Page length.

3. Output Parameters

Parameter Name Type Description
Records Array of ApmMetricRecord Indicator result set.
TotalCount Integer Number of metric query result sets.
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.

4. Example

Example1 Request Parameter Example

This example shows you how to create a scenario.

Input Example

POST / HTTP/1.1
Host: apm.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeMetricRecords
<Common request parameters>

{
    "OrderBy": {
        "Key": "service_duration_avg",
        "Value": "DESC"
    },
    "Filters": [
        {
            "Type": "=",
            "Key": "span.kind",
            "Value": "server"
        }
    ],
    "InstanceId": "apm-6xYKFXYxo",
    "BusinessName": "taw",
    "Metrics": [
        {
            "Compare": "1",
            "Compares": [
                "CompareByYesterday",
                "CompareByLastWeek"
            ],
            "MetricName": "qps"
        }
    ],
    "Limit": "10",
    "StartTime": "1618361193",
    "Offset": "22",
    "EndTime": "1618677137",
    "PageIndex": 1,
    "PageSize": 10,
    "GroupBy": [
        "service.instance"
    ]
}

Output Example

{
    "Response": {
        "Records": [
            {
                "Fields": [
                    {
                        "CompareVal": "",
                        "CompareVals": [
                            {
                                "Key": "CompareByYesterday",
                                "Value": "1%"
                            }
                        ],
                        "Value": 0,
                        "Unit": "",
                        "Key": "service_duration_avg",
                        "LastPeriodValue": [
                            {
                                "Key": "CompareByYesterday",
                                "Value": 71308388
                            }
                        ]
                    }
                ],
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "java-order-demo"
                    }
                ]
            }
        ],
        "TotalCount": 0,
        "RequestId": "test-test-test"
    }
}

Example2 General API for Metric List

This example shows you how to use scenario 2.

Input Example

POST / HTTP/1.1
Host: apm.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeMetricRecords
<Common request parameters>

{
    "Filters": [
        {
            "Key": "span.kind",
            "Type": "in",
            "Value": "server,consumer"
        }
    ],
    "Metrics": [
        {
            "MetricName": "duration_avg",
            "Compares": [
                "CompareByYesterday",
                "CompareByLastWeek"
            ]
        }
    ],
    "GroupBy": [
        "service.instance"
    ],
    "Limit": 10,
    "Offset": 1,
    "StartTime": 1618361193,
    "EndTime": 1618677137,
    "InstanceId": "apm-CVfliqa8U",
    "OrderBy": {
        "Key": "duration_avg",
        "Value": "DESC"
    }
}

Output Example

{
    "Response": {
        "Records": [
            {
                "Fields": [
                    {
                        "LastPeriodValue": [
                            {
                                "Key": "CompareByYesterday",
                                "Value": 71308388
                            }
                        ],
                        "CompareVal": "CompareByYesterday",
                        "Unit": "s",
                        "Value": 691.42,
                        "Key": "duration_avg",
                        "CompareVals": [
                            {
                                "Value": "CompareByYesterday",
                                "Key": "2%"
                            },
                            {
                                "Key": "CompareByLastWeek",
                                "Value": "-1%"
                            }
                        ]
                    }
                ],
                "Tags": [
                    {
                        "Value": "service.name",
                        "Key": "java-order-demo"
                    }
                ]
            }
        ],
        "RequestId": "test-test-test",
        "TotalCount": 0
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

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.InvalidRequest Invalid request.
InternalError Internal error.
InvalidParameter Parameter error.
本页内容是否解决了您的问题?
您也可以 联系销售 提交工单 以寻求帮助。

文档反馈