tencent cloud

All product documents
APIs
DescribeMetricRecords
Last updated: 2025-02-25 15:57:59
DescribeMetricRecords
Last updated: 2025-02-25 15:57:59

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 No String Business system id.
StartTime No Integer Start time (unit: sec).
EndTime No Integer End time (unit: seconds).
Filters.N No Array of Filter Filter criteria.
OrFilters.N No Array of Filter Or filter criteria.
GroupBy.N No Array of String Aggregation dimension.
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 Example Of Request Parameters

Scenario 1

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 Common Metrics List API

Scene 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,
    "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.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support