tencent cloud

All product documents
Application Performance Management
DescribeGeneralMetricData
Last updated: 2025-02-25 15:58:04
DescribeGeneralMetricData
Last updated: 2025-02-25 15:58:04

1. API Description

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

This API is a general API used to obtain metric data. Users submit request parameters as needed and receive the corresponding metric data.
The API call frequency is limited to 20 requests per second and 1200 requests per minute. The number of data points per request is limited to 1440.

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: 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://www.tencentcloud.com/document/product/248/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://www.tencentcloud.com/document/product/248/101681?from_cn_redirect=1.).
GroupBy.N No Array of String Aggregated dimension; different views have corresponding metric dimensions. (for details, see https://www.tencentcloud.com/document/product/248/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, +∞) 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.

3. Output Parameters

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.

4. Example

Example1 Querying Service Metric Data With 1-Minute Aggregation Granularity Example

This example shows you how to query the business system apm-059oXBfTL, filter by dimensions of service.name (application name) and span.kind (client/server perspective), aggregate by service.name (application name) and span.kind (client/server perspective), and find metric data such as request_count (number of requests), error_request_count (number of error requests), duration_avg (average response time), slow_request_count (number of slow requests), and duration_p50 (time p50) within the start time to end time at an aggregation granularity of one minute.

Input Example

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

{
    "Filters": [
        {
            "Key": "service.name",
            "Value": "ot-java-order-service"
        },
        {
            "Key": "span.kind",
            "Value": "client"
        }
    ],
    "ViewName": "service_metric",
    "InstanceId": "apm-059oXBfTL",
    "Period": 60,
    "Metrics": [
        "request_count",
        "error_request_count",
        "duration_avg",
        "slow_request_count",
        "duration_p50"
    ],
    "StartTime": 1734415200,
    "EndTime": 1734418800,
    "GroupBy": [
        "service.name",
        "span.kind"
    ]
}

Output Example

{
    "Response": {
        "Records": [
            {
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    },
                    {
                        "Key": "span.kind",
                        "Value": "client"
                    }
                ],
                "MetricName": "request_count",
                TotalRequests
                "TimeSerial": [
                    1734415200,
                    1734415260,
                    1734415320,
                    1734415380,
                    1734415440,
                    1734415500,
                    1734415560,
                    1734415620,
                    1734415680,
                    1734415740,
                    1734415800,
                    1734415860,
                    1734415920,
                    1734415980,
                    1734416040,
                    1734416100,
                    1734416160,
                    1734416220,
                    1734416280,
                    1734416340,
                    1734416400,
                    1734416460,
                    1734416520,
                    1734416580,
                    1734416640,
                    1734416700,
                    1734416760,
                    1734416820,
                    1734416880,
                    1734416940,
                    1734417000,
                    1734417060,
                    1734417120,
                    1734417180,
                    1734417240,
                    1734417300,
                    1734417360,
                    1734417420,
                    1734417480,
                    1734417540,
                    1734417600,
                    1734417660,
                    1734417720,
                    1734417780,
                    1734417840,
                    1734417900,
                    1734417960,
                    1734418020,
                    1734418080,
                    1734418140,
                    1734418200,
                    1734418260,
                    1734418320,
                    1734418380,
                    1734418440,
                    1734418500,
                    1734418560,
                    1734418620,
                    1734418680,
                    1734418740
                ],
                "DataSerial": [
                    22,
                    32,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    32,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    26,
                    28,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    32,
                    12,
                    22,
                    22,
                    32,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    22,
                    32,
                    22,
                    12,
                    22,
                    22
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "span.kind",
                        "Value": "client"
                    },
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    }
                ],
                "MetricName": "error_request_count",
                "ExceptionCount"
                "TimeSerial": [
                    1734415200,
                    1734415260,
                    1734415320,
                    1734415380,
                    1734415440,
                    1734415500,
                    1734415560,
                    1734415620,
                    1734415680,
                    1734415740,
                    1734415800,
                    1734415860,
                    1734415920,
                    1734415980,
                    1734416040,
                    1734416100,
                    1734416160,
                    1734416220,
                    1734416280,
                    1734416340,
                    1734416400,
                    1734416460,
                    1734416520,
                    1734416580,
                    1734416640,
                    1734416700,
                    1734416760,
                    1734416820,
                    1734416880,
                    1734416940,
                    1734417000,
                    1734417060,
                    1734417120,
                    1734417180,
                    1734417240,
                    1734417300,
                    1734417360,
                    1734417420,
                    1734417480,
                    1734417540,
                    1734417600,
                    1734417660,
                    1734417720,
                    1734417780,
                    1734417840,
                    1734417900,
                    1734417960,
                    1734418020,
                    1734418080,
                    1734418140,
                    1734418200,
                    1734418260,
                    1734418320,
                    1734418380,
                    1734418440,
                    1734418500,
                    1734418560,
                    1734418620,
                    1734418680,
                    1734418740
                ],
                "DataSerial": [
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    },
                    {
                        "Key": "span.kind",
                        "Value": "client"
                    }
                ],
                "MetricName": "duration_avg",
                Average Response Time
                "TimeSerial": [
                    1734415200,
                    1734415260,
                    1734415320,
                    1734415380,
                    1734415440,
                    1734415500,
                    1734415560,
                    1734415620,
                    1734415680,
                    1734415740,
                    1734415800,
                    1734415860,
                    1734415920,
                    1734415980,
                    1734416040,
                    1734416100,
                    1734416160,
                    1734416220,
                    1734416280,
                    1734416340,
                    1734416400,
                    1734416460,
                    1734416520,
                    1734416580,
                    1734416640,
                    1734416700,
                    1734416760,
                    1734416820,
                    1734416880,
                    1734416940,
                    1734417000,
                    1734417060,
                    1734417120,
                    1734417180,
                    1734417240,
                    1734417300,
                    1734417360,
                    1734417420,
                    1734417480,
                    1734417540,
                    1734417600,
                    1734417660,
                    1734417720,
                    1734417780,
                    1734417840,
                    1734417900,
                    1734417960,
                    1734418020,
                    1734418080,
                    1734418140,
                    1734418200,
                    1734418260,
                    1734418320,
                    1734418380,
                    1734418440,
                    1734418500,
                    1734418560,
                    1734418620,
                    1734418680,
                    1734418740
                ],
                "DataSerial": [
                    191.5860133181818,
                    191.2110746363636,
                    191.23246599999996,
                    191.5040949090909,
                    191.934274,
                    192.05015977272723,
                    191.4917418636364,
                    191.7598401818182,
                    191.47329104545454,
                    191.35408840909093,
                    191.7695753181818,
                    192.1501132727273,
                    191.6614135,
                    191.72522395454544,
                    193.92501624242422,
                    209.9224584090909,
                    192.50587436363637,
                    193.14908313636363,
                    200.8337476363636,
                    192.21551695454545,
                    191.87317959090907,
                    191.85476931818184,
                    192.0314575909091,
                    192.14624168181817,
                    192.0624055,
                    192.35865707575758,
                    191.87331737878793,
                    191.806969,
                    192.35163881818187,
                    192.29478813636362,
                    192.3707790454545,
                    191.8557721363636,
                    191.59646177272725,
                    191.55687904545456,
                    191.59595163636365,
                    191.84944554545453,
                    191.78630649999997,
                    191.91973590909092,
                    191.90514081818182,
                    191.9165850909091,
                    191.98103199999997,
                    191.98323287878785,
                    193.0803381818182,
                    192.14093727272729,
                    192.24286899999998,
                    192.6753041818182,
                    192.2717468636364,
                    192.41461836363635,
                    192.3725805,
                    191.84485977272726,
                    191.85852840909092,
                    191.86218731818178,
                    191.6467590454545,
                    191.52699904545452,
                    191.57099809090911,
                    192.2197160909091,
                    191.91881845454546,
                    191.98860699999997,
                    224.0602859090909,
                    192.05223709090907
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    },
                    {
                        "Key": "span.kind",
                        "Value": "client"
                    }
                ],
                "MetricName": "slow_request_count",
                {Slow Call}
                "TimeSerial": [
                    1734415200,
                    1734415260,
                    1734415320,
                    1734415380,
                    1734415440,
                    1734415500,
                    1734415560,
                    1734415620,
                    1734415680,
                    1734415740,
                    1734415800,
                    1734415860,
                    1734415920,
                    1734415980,
                    1734416040,
                    1734416100,
                    1734416160,
                    1734416220,
                    1734416280,
                    1734416340,
                    1734416400,
                    1734416460,
                    1734416520,
                    1734416580,
                    1734416640,
                    1734416700,
                    1734416760,
                    1734416820,
                    1734416880,
                    1734416940,
                    1734417000,
                    1734417060,
                    1734417120,
                    1734417180,
                    1734417240,
                    1734417300,
                    1734417360,
                    1734417420,
                    1734417480,
                    1734417540,
                    1734417600,
                    1734417660,
                    1734417720,
                    1734417780,
                    1734417840,
                    1734417900,
                    1734417960,
                    1734418020,
                    1734418080,
                    1734418140,
                    1734418200,
                    1734418260,
                    1734418320,
                    1734418380,
                    1734418440,
                    1734418500,
                    1734418560,
                    1734418620,
                    1734418680,
                    1734418740
                ],
                "DataSerial": [
                    2,
                    3,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    3,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    3,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    3,
                    1,
                    2,
                    2,
                    3,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    3,
                    2,
                    1,
                    2,
                    2
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    },
                    {
                        "Key": "span.kind",
                        "Value": "client"
                    }
                ],
                "MetricName": "duration_p50",
                P50 Response Time
                "TimeSerial": [
                    1734415200,
                    1734415260,
                    1734415320,
                    1734415380,
                    1734415440,
                    1734415500,
                    1734415560,
                    1734415620,
                    1734415680,
                    1734415740,
                    1734415800,
                    1734415860,
                    1734415920,
                    1734415980,
                    1734416040,
                    1734416100,
                    1734416160,
                    1734416220,
                    1734416280,
                    1734416340,
                    1734416400,
                    1734416460,
                    1734416520,
                    1734416580,
                    1734416640,
                    1734416700,
                    1734416760,
                    1734416820,
                    1734416880,
                    1734416940,
                    1734417000,
                    1734417060,
                    1734417120,
                    1734417180,
                    1734417240,
                    1734417300,
                    1734417360,
                    1734417420,
                    1734417480,
                    1734417540,
                    1734417600,
                    1734417660,
                    1734417720,
                    1734417780,
                    1734417840,
                    1734417900,
                    1734417960,
                    1734418020,
                    1734418080,
                    1734418140,
                    1734418200,
                    1734418260,
                    1734418320,
                    1734418380,
                    1734418440,
                    1734418500,
                    1734418560,
                    1734418620,
                    1734418680,
                    1734418740
                ],
                "DataSerial": [
                    10,
                    10,
                    9.375,
                    14,
                    14,
                    14,
                    10,
                    9.375,
                    9.285714285714285,
                    9.166666666666668,
                    10,
                    14,
                    14,
                    14,
                    15.714285714285714,
                    14.444444444444445,
                    14,
                    14,
                    14.444444444444445,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    13.333333333333332,
                    16.153846153846153,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    15.333333333333332,
                    16.666666666666664,
                    14,
                    14,
                    15.333333333333332,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    14,
                    15.333333333333332,
                    14,
                    10,
                    14.444444444444445,
                    14
                ]
            }
        ],
        "RequestId": "test-test-test"
    }
}

Example2 Query Example Of Service_metric Indicator Data From Start To Termination Time

This example shows you how to query the business system apm-059oXBfTL, filter by dimensions of service.name (application name) and span.kind (client/server perspective), aggregate by service.name (application name) and span.kind (client/server perspective), and find metric data such as request_count (request quantity), error_request_count (error request quantity), duration_avg (average response time), slow_request_count (number of slow requests), and duration_p50 (time p50) within the start time to end time, with one minute as the aggregation granularity.

Input Example

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

{
    "Filters": [
        {
            "Key": "service.name",
            "Value": "ot-java-order-service"
        },
        {
            "Key": "span.kind",
            "Value": "client"
        }
    ],
    "ViewName": "service_metric",
    "InstanceId": "apm-059oXBfTL",
    "Metrics": [
        "request_count",
        "error_request_count",
        "duration_avg",
        "slow_request_count",
        "duration_p50"
    ],
    "StartTime": 1734415200,
    "EndTime": 1734418800,
    "GroupBy": [
        "service.name",
        "span.kind"
    ]
}

Output Example

{
    "Response": {
        "Records": [
            {
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    },
                    {
                        "Key": "span.kind",
                        "Value": "client"
                    }
                ],
                "MetricName": "request_count",
                Total Number of Requests
                "TimeSerial": [],
                "DataSerial": [
                    1360
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    },
                    {
                        "Key": "span.kind",
                        "Value": "client"
                    }
                ],
                "MetricName": "error_request_count",
                Number of Exceptions
                "TimeSerial": [],
                "DataSerial": [
                    0
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    },
                    {
                        "Key": "span.kind",
                        "Value": "client"
                    }
                ],
                "MetricName": "duration_avg",
                Average Response Time
                "TimeSerial": [],
                "DataSerial": [
                    192.96957006641412
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    },
                    {
                        "Key": "span.kind",
                        "Value": "client"
                    }
                ],
                "MetricName": "slow_request_count",
                Slow Call
                "TimeSerial": [],
                "DataSerial": [
                    124
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    },
                    {
                        "Key": "span.kind",
                        "Value": "client"
                    }
                ],
                "MetricName": "duration_p50",
                P50 Response Time
                "TimeSerial": [],
                "DataSerial": [
                    13.443708609271523
                ]
            }
        ],
        "RequestId": "test-test-test"
    }
}

Example3 Example Of Querying Sql_metric Metric Data With 1-Minute Aggregation Granularity

This example shows you how to query the business system apm-059oXBfTL, filter by the dimensional service.name (application name), aggregate by service.name (application name), and find the metric data of error_request_count (error request quantity) and duration_avg (average response time) within the start time-termination time at a one-minute aggregation granularity.

Input Example

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

{
    "Filters": [
        {
            "Key": "service.name",
            "Value": "ot-java-order-service"
        }
    ],
    "ViewName": "sql_metric",
    "InstanceId": "apm-059oXBfTL",
    "Period": 60,
    "Metrics": [
        "error_request_count",
        "duration_avg"
    ],
    "StartTime": 1734415200,
    "EndTime": 1734418800,
    "GroupBy": [
        "service.name"
    ]
}

Output Example

{
    "Response": {
        "Records": [
            {
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    }
                ],
                "MetricName": "error_request_count",
                "MetricNameCN": "Number of Errors"
                "TimeSerial": [
                    1734415200,
                    1734415260,
                    1734415320,
                    1734415380,
                    1734415440,
                    1734415500,
                    1734415560,
                    1734415620,
                    1734415680,
                    1734415740,
                    1734415800,
                    1734415860,
                    1734415920,
                    1734415980,
                    1734416040,
                    1734416100,
                    1734416160,
                    1734416220,
                    1734416280,
                    1734416340,
                    1734416400,
                    1734416460,
                    1734416520,
                    1734416580,
                    1734416640,
                    1734416700,
                    1734416760,
                    1734416820,
                    1734416880,
                    1734416940,
                    1734417000,
                    1734417060,
                    1734417120,
                    1734417180,
                    1734417240,
                    1734417300,
                    1734417360,
                    1734417420,
                    1734417480,
                    1734417540,
                    1734417600,
                    1734417660,
                    1734417720,
                    1734417780,
                    1734417840,
                    1734417900,
                    1734417960,
                    1734418020,
                    1734418080,
                    1734418140,
                    1734418200,
                    1734418260,
                    1734418320,
                    1734418380,
                    1734418440,
                    1734418500,
                    1734418560,
                    1734418620,
                    1734418680,
                    1734418740
                ],
                "DataSerial": [
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    }
                ],
                "MetricName": "duration_avg",
                Average Response Time
                "TimeSerial": [
                    1734415200,
                    1734415260,
                    1734415320,
                    1734415380,
                    1734415440,
                    1734415500,
                    1734415560,
                    1734415620,
                    1734415680,
                    1734415740,
                    1734415800,
                    1734415860,
                    1734415920,
                    1734415980,
                    1734416040,
                    1734416100,
                    1734416160,
                    1734416220,
                    1734416280,
                    1734416340,
                    1734416400,
                    1734416460,
                    1734416520,
                    1734416580,
                    1734416640,
                    1734416700,
                    1734416760,
                    1734416820,
                    1734416880,
                    1734416940,
                    1734417000,
                    1734417060,
                    1734417120,
                    1734417180,
                    1734417240,
                    1734417300,
                    1734417360,
                    1734417420,
                    1734417480,
                    1734417540,
                    1734417600,
                    1734417660,
                    1734417720,
                    1734417780,
                    1734417840,
                    1734417900,
                    1734417960,
                    1734418020,
                    1734418080,
                    1734418140,
                    1734418200,
                    1734418260,
                    1734418320,
                    1734418380,
                    1734418440,
                    1734418500,
                    1734418560,
                    1734418620,
                    1734418680,
                    1734418740
                ],
                "DataSerial": [
                    504.4455225,
                    504.49955074999997,
                    504.50165175000006,
                    504.55699425,
                    504.5483053749999,
                    504.547519,
                    504.73789837500004,
                    504.46199262500005,
                    504.1922,
                    504.22497787500004,
                    504.18011225000004,
                    504.04929475,
                    504.14939112499997,
                    504.45689225,
                    504.4441259166667,
                    504.4853475,
                    504.55031125,
                    504.458504875,
                    504.49732837499994,
                    504.50629599999996,
                    504.439337,
                    504.272122,
                    504.267848625,
                    504.28821525,
                    504.268522875,
                    504.28563437500003,
                    504.25491391666674,
                    504.20538062500003,
                    504.54045425000004,
                    504.67349375000003,
                    504.71599025,
                    504.54132337499993,
                    504.69503825,
                    504.74425037500004,
                    504.637164375,
                    504.62155600000006,
                    504.628113,
                    505.07725949999997,
                    504.65562800000004,
                    504.443061375,
                    504.420146125,
                    504.41736325000005,
                    507.28285875,
                    504.59916025,
                    504.50750687499993,
                    504.67656166666666,
                    504.687698625,
                    504.7468005,
                    504.728723,
                    504.71881125,
                    504.6750935,
                    504.45997087499995,
                    504.48766912499997,
                    504.5063645,
                    504.670277625,
                    504.88526525,
                    505.09475625,
                    505.13066475,
                    505.103745375,
                    505.101275
                ]
            }
        ],
        "RequestId": "test-test-test"
    }
}

Example4 Example Of Querying Metric Data For Duration_avg (Duration) Of Sql_metric From Start To Termination Time

This example shows you how to query the business system apm-059oXBfTL, filter by db.instance (database name) as a dimensional , aggregate by service.name (application name) and db.statement (execution statement) as dimensions, and find the top5 duration_avg (duration (ms)) metric data within the start time - termination time.

Input Example

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

{
    "Filters": [
        {
            "Key": "db.instance",
            "Value": "mock_project_db"
        }
    ],
    "ViewName": "sql_metric",
    "InstanceId": "apm-059oXBfTL",
    "Metrics": [
        "duration_avg"
    ],
    "StartTime": 1734415200,
    "EndTime": 1734418800,
    "GroupBy": [
        "service.name",
        "db.statement"
    ],
    "OrderBy": {
        "Key": "sql_duration_avg",
        "Value": "desc"
    },
    "PageSize": 5
}

Output Example

{
    "Response": {
        "Records": [
            {
                "Tags": [
                    {
                        "Key": "db.statement",
                        "Value": "select sleep(?)"
                    },
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    }
                ],
                "MetricName": "duration_avg",
                Average Response Time
                "TimeSerial": [],
                "DataSerial": [
                    2005.583661869444
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "ot-java-stock-service"
                    },
                    {
                        "Key": "db.statement",
                        "Value": "select dept, count(dept) as total from mock_project_userinfo"
                    }
                ],
                "MetricName": "duration_avg",
                Average Response Time
                "TimeSerial": [],
                "DataSerial": [
                    5.746467460185185
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "db.statement",
                        "Value": "select dept, count(dept) as total from mock_project_userinfo"
                    },
                    {
                        "Key": "service.name",
                        "Value": "ot-java-user-service"
                    }
                ],
                "MetricName": "duration_avg",
                Average Response Time
                "TimeSerial": [],
                "DataSerial": [
                    5.719407256481479
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "db.statement",
                        "Value": "select * from mock_project_userinfo"
                    },
                    {
                        "Key": "service.name",
                        "Value": "ot-java-order-service"
                    }
                ],
                "MetricName": "duration_avg",
                Average Response Time
                "TimeSerial": [],
                "DataSerial": [
                    5.677464627777778
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "db.statement",
                        "Value": "select * from mock_project_userinfo"
                    },
                    {
                        "Key": "service.name",
                        "Value": "ot-java-delivery-service"
                    }
                ],
                "MetricName": "duration_avg",
                Average Response Time
                "TimeSerial": [],
                "DataSerial": [
                    5.636013505555556
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "db.statement",
                        "Value": "select * om un_exist_table limit ?"
                    },
                    {
                        "Key": "service.name",
                        "Value": "ot-java-delivery-service"
                    }
                ],
                "MetricName": "duration_avg",
                Average Response Time
                "TimeSerial": [],
                "DataSerial": [
                    5.514262441666669
                ]
            },
            {
                "Tags": [
                    {
                        "Key": "db.statement",
                        "Value": "select dept, count(dept) as total from mock_project_userinfo"
                    },
                    {
                        "Key": "service.name",
                        "Value": "ot-java-market-service"
                    }
                ],
                "MetricName": "duration_avg",
                Average Response Time
                "TimeSerial": [],
                "DataSerial": [
                    5.44814345277778
                ]
            }
        ],
        "RequestId": "test-test-test"
    }
}

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.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.
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
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon