获取 APM 应用指标

最近更新时间:2025-09-30 01:10:02

我的收藏

1. 接口描述

接口请求域名: apm.tencentcloudapi.com 。

获取 APM 应用指标列表

默认接口请求频率限制:20次/秒。

推荐使用 API Explorer
点击调试
API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数

参数名称 必选 类型 描述
Action String 公共参数,本接口取值:DescribeApmServiceMetric。
Version String 公共参数,本接口取值:2021-06-22。
Region String 公共参数,详见产品支持的 地域列表
InstanceId String 业务系统ID
示例值:apm-CVfliqa8U
ServiceName String 应用名
示例值:apm_test
ServiceID String 应用ID
示例值:svc-JRNE5rvV8
StartTime Integer 开始时间
示例值:1719317419
EndTime Integer 结束时间
示例值:1720580629
OrderBy OrderBy 排序
Demo Boolean 是否demo模式
示例值:false
ServiceStatus String 应用状态筛选,可枚举的值为:health、warning、error。如果选中多个状态用逗号隔开,例如:"warning,error"
示例值:health
Tags.N Array of ApmTag 标签列表
Page Integer 页码
示例值:1
PageSize Integer 页大小
示例值:2
Filters.N Array of Filter 过滤条件

3. 输出参数

参数名称 类型 描述
ServiceMetricList Array of ApmServiceMetric 应用指标列表
TotalCount Integer 符合筛选条件的应用数
示例值:3
WarningErrorCount Integer 警示异常应用数
示例值:2
ApplicationCount Integer 应用总数
示例值:7
Page Integer 页码
示例值:1
PageSize Integer 页大小
示例值:2
ErrorCount Integer 异常应用数
示例值:1
WarningCount Integer 警示应用数
示例值:1
RequestId String 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。

4. 示例

示例1 成功获取APM应用指标

获取APM应用指标

输入示例

POST / HTTP/1.1
Host: apm.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeApmServiceMetric
<公共请求参数>

{
    "InstanceId": "apm-eDyXpD6CD"
}

输出示例

{
    "Response": {
        "ApplicationCount": 1,
        "ErrorCount": 1,
        "Page": 0,
        "PageSize": 0,
        "RequestId": "84d35deb-232e-463e-b2ac-fe49338707a2",
        "ServiceMetricList": [
            {
                "Fields": [
                    {
                        "CompareVal": "0.9%",
                        "CompareVals": null,
                        "Key": "duration_avg",
                        "LastPeriodValue": [
                            {
                                "Key": "CompareByYesterday",
                                "Value": 681.7527368527665
                            }
                        ],
                        "NameCN": "平均响应时间",
                        "NameEN": "Average Response Time",
                        "Unit": "ms",
                        "Value": 688
                    },
                    {
                        "CompareVal": "-1.7%",
                        "CompareVals": null,
                        "Key": "qps",
                        "LastPeriodValue": [
                            {
                                "Key": "CompareByYesterday",
                                "Value": 0.40692708333333333
                            }
                        ],
                        "NameCN": "平均请求量",
                        "NameEN": "Average RPS",
                        "Unit": "qps",
                        "Value": 0.4
                    },
                    {
                        "CompareVal": "-0.3%",
                        "CompareVals": null,
                        "Key": "request_count_sum",
                        "LastPeriodValue": [
                            {
                                "Key": "CompareByYesterday",
                                "Value": 70317
                            }
                        ],
                        "NameCN": "总请求数",
                        "NameEN": "Total Requests",
                        "Unit": "",
                        "Value": 70129
                    },
                    {
                        "CompareVal": "0.0%",
                        "CompareVals": null,
                        "Key": "error_req_rate_avg",
                        "LastPeriodValue": [
                            {
                                "Key": "CompareByYesterday",
                                "Value": 62.81837962370408
                            }
                        ],
                        "NameCN": "平均错误率",
                        "NameEN": "Average Error Rate",
                        "Unit": "%",
                        "Value": 62.8
                    },
                    {
                        "CompareVal": "-4.4%",
                        "CompareVals": null,
                        "Key": "adpdex",
                        "LastPeriodValue": [
                            {
                                "Key": "CompareByYesterday",
                                "Value": 0.7325824480566577
                            }
                        ],
                        "NameCN": "平均 Apdex",
                        "NameEN": "Average Apdex",
                        "Unit": "",
                        "Value": 0.7
                    },
                    {
                        "CompareVal": "0",
                        "CompareVals": null,
                        "Key": "alarm_count",
                        "LastPeriodValue": [
                            {
                                "Key": "CompareByYesterday",
                                "Value": 0
                            }
                        ],
                        "NameCN": "告警数",
                        "NameEN": "Alarm Count",
                        "Unit": "次",
                        "Value": 0
                    },
                    {
                        "CompareVal": "-0.4%",
                        "CompareVals": null,
                        "Key": "error_request_count",
                        "LastPeriodValue": [
                            {
                                "Key": "CompareByYesterday",
                                "Value": 44172
                            }
                        ],
                        "NameCN": "异常数量",
                        "NameEN": "Error Count",
                        "Unit": "个",
                        "Value": 44008
                    },
                    {
                        "CompareVal": "",
                        "CompareVals": null,
                        "Key": "instance_count",
                        "LastPeriodValue": null,
                        "NameCN": "",
                        "NameEN": "",
                        "Unit": "",
                        "Value": 1
                    },
                    {
                        "CompareVal": "",
                        "CompareVals": null,
                        "Key": "critical_vulnerability_count",
                        "LastPeriodValue": null,
                        "NameCN": "",
                        "NameEN": "",
                        "Unit": "",
                        "Value": 0
                    },
                    {
                        "CompareVal": "",
                        "CompareVals": null,
                        "Key": "important_vulnerability_count",
                        "LastPeriodValue": null,
                        "NameCN": "",
                        "NameEN": "",
                        "Unit": "",
                        "Value": 0
                    },
                    {
                        "CompareVal": "",
                        "CompareVals": null,
                        "Key": "vulnerability_count",
                        "LastPeriodValue": null,
                        "NameCN": "",
                        "NameEN": "",
                        "Unit": "",
                        "Value": 0
                    }
                ],
                "ServiceDetail": {
                    "AppID": 250015922,
                    "CreateUIN": "1511340626",
                    "InstanceKey": "apm-eDyXpD6CD",
                    "InstanceName": "",
                    "Region": "ap-guangzhou",
                    "ServiceDescription": "",
                    "ServiceID": "svc-ELHkoErzzc",
                    "ServiceName": "java-order-service",
                    "Tags": []
                },
                "Tags": [
                    {
                        "Key": "service.name",
                        "Value": "java-order-service"
                    },
                    {
                        "Key": "color",
                        "Value": "red"
                    }
                ]
            }
        ],
        "TotalCount": 1,
        "WarningCount": 0,
        "WarningErrorCount": 1
    }
}

5. 开发者资源

腾讯云 API 平台

腾讯云 API 平台 是综合 API 文档、错误码、API Explorer 及 SDK 等资源的统一查询平台,方便您从同一入口查询及使用腾讯云提供的所有 API 服务。

API Inspector

用户可通过 API Inspector 查看控制台每一步操作关联的 API 调用情况,并自动生成各语言版本的 API 代码,也可前往 API Explorer 进行在线调试。

SDK

云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。

命令行工具

6. 错误码

以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码

错误码 描述
AuthFailure.AccessCAMFail CAM鉴权失败
AuthFailure.UnmarshalResponse CAM鉴权解析失败
FailedOperation 操作失败。
FailedOperation.ServiceNotFound 没有找到应用资源
FailedOperation.ServiceNotMatchAppIdErr serviceId 与 appId 不匹配