获取拓扑图

最近更新时间:2025-12-25 01:09:21

我的收藏

1. 接口描述

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

根据应用名查询服务拓扑图

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

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

2. 输入参数

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

参数名称 必选 类型 描述
Action String 公共参数,本接口取值:DescribeTopologyNew。
Version String 公共参数,本接口取值:2021-06-22。
Region String 公共参数,详见产品支持的 地域列表
InstanceId String 业务系统 ID
示例值:apm-52Dpv13GR
StartTime Integer 查询开始时间
示例值:1617163200
EndTime Integer 查询结束时间
示例值:1617192000
ServiceName String 应用名
示例值:java-order-service
UpLevel Integer 上游层级
示例值:2
ServiceInstance String 应用实例信息
示例值:127.0.0.1
DownLevel Integer 下游层级
示例值:2
View String 视角
示例值:db
Filters.N Array of Filter 过滤器
示例值:[ { "key":"TraceID", "operator":"eq", "value":"9c35b592750d5e0c15bd202bbae57a29" } ]
Topic String 表示Topic(MQ拓扑图用)
示例值:prod.ecommerce.order.created.v1
Selectors Selectors 视图筛选列表
示例值:{ "Component":[ "Service", "MQ", "Database" ] }
Id String 视图ID
示例值:topo_apm-xxxxyzj_6d15af9600d6e8aefd739a2
TraceID String TraceID
示例值:9c35b592750d5e0c15bd202bbae57a29
IsSlowTopFive Boolean 查询top5慢响应节点
示例值:true
GetResource Boolean 是否获取资源层信息
示例值:true
Tags.N Array of ApmTag 根据应用标签过滤
示例值:[ { "Key": "运营产品", "Value": "云监控产品" } ]
Hidden Selectors 不显示的节点类型
示例值:{ "Component":[ "MQ", "Database" ] }

3. 输出参数

参数名称 类型 描述
Nodes Array of TopologyNode 节点集合
注意:此字段可能返回 null,表示取不到有效值。
Edges Array of TopologyEdgeNew 边集合
TopologyModifyFlag Integer 拓扑图是否有修改
注意:此字段可能返回 null,表示取不到有效值。
Selectors SelectorView 节点数量
注意:此字段可能返回 null,表示取不到有效值。
RequestId String 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。

4. 示例

示例1 数据库示例

输入示例

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

{
    "EndTime": "1650683106",
    "InstanceId": "apm-6xYKFXYxo",
    "DownLevel": "1",
    "UpLevel": "1",
    "ServiceName": "mock_project_db",
    "StartTime": "1650610585",
    "View": "db",
    "ServiceInstance": "apm-6xYKFXYxo"
}

输出示例

{
    "Response": {
        "Edges": [
            {
                "Id": "tingyun-java-order-service_0",
                "Weight": 1,
                "Source": "tingyun-java-order-service",
                "Target": "0",
                "Duration": 4.76,
                "ErrRate": 0,
                "Qps": 13.27,
                "Type": "",
                "Color": "green",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "user-service_mock_project_db",
                "Weight": 1,
                "Source": "user-service",
                "Target": "mock_project_db",
                "Duration": 6.73,
                "ErrRate": 0,
                "Qps": 635.27,
                "Type": "",
                "Color": "green",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "tingyun-java-user-service_mock_project_db",
                "Weight": 1,
                "Source": "tingyun-java-user-service",
                "Target": "mock_project_db",
                "Duration": 5.3,
                "ErrRate": 0.819672131147541,
                "Qps": 32.53,
                "Type": "",
                "Color": "green",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "tingyun-java-stock-service_mock_project_db",
                "Weight": 1,
                "Source": "tingyun-java-stock-service",
                "Target": "mock_project_db",
                "Duration": 5.34,
                "ErrRate": 0.5376344086021506,
                "Qps": 37.2,
                "Type": "",
                "Color": "green",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "tingyun-java-order-service_mock_project_db",
                "Weight": 1,
                "Source": "tingyun-java-order-service",
                "Target": "mock_project_db",
                "Duration": 5.02,
                "ErrRate": 0.9852216748768473,
                "Qps": 13.53,
                "Type": "",
                "Color": "green",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "tingyun-java-market-service_mock_project_db",
                "Weight": 1,
                "Source": "tingyun-java-market-service",
                "Target": "mock_project_db",
                "Duration": 5.7,
                "ErrRate": 0.17152658662092624,
                "Qps": 38.87,
                "Type": "",
                "Color": "green",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "tingyun-java-delivery-service_mock_project_db",
                "Weight": 1,
                "Source": "tingyun-java-delivery-service",
                "Target": "mock_project_db",
                "Duration": 5.47,
                "ErrRate": 0,
                "Qps": 13.33,
                "Type": "",
                "Color": "green",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "stock-service_mock_project_db",
                "Weight": 1,
                "Source": "stock-service",
                "Target": "mock_project_db",
                "Duration": 8.57,
                "ErrRate": 0,
                "Qps": 966.53,
                "Type": "",
                "Color": "green",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "market-service_mock_project_db",
                "Weight": 1,
                "Source": "market-service",
                "Target": "mock_project_db",
                "Duration": 15.15,
                "ErrRate": 0,
                "Qps": 643.33,
                "Type": "",
                "Color": "green",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "java-order-service_mock_project_db",
                "Weight": 1,
                "Source": "java-order-service",
                "Target": "mock_project_db",
                "Duration": 1,
                "ErrRate": 0,
                "Qps": 0.07,
                "Type": "",
                "Color": "green",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "java-market-service_mock_project_db",
                "Weight": 1,
                "Source": "java-market-service",
                "Target": "mock_project_db",
                "Duration": 1,
                "ErrRate": 0,
                "Qps": 0.07,
                "Type": "",
                "Color": "green",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "java-delivery-service_mock_project_db",
                "Weight": 1,
                "Source": "java-delivery-service",
                "Target": "mock_project_db",
                "Duration": 1,
                "ErrRate": 0,
                "Qps": 0.07,
                "Type": "",
                "Color": "green",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "User_tingyun-java-stock-service",
                "Weight": 1,
                "Source": "User",
                "Target": "tingyun-java-stock-service",
                "Duration": 0,
                "ErrRate": 0,
                "Qps": 0,
                "Type": "virtual",
                "Color": "",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "User_stock-service",
                "Weight": 1,
                "Source": "User",
                "Target": "stock-service",
                "Duration": 0,
                "ErrRate": 0,
                "Qps": 0,
                "Type": "virtual",
                "Color": "",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "User_tingyun-java-delivery-service",
                "Weight": 1,
                "Source": "User",
                "Target": "tingyun-java-delivery-service",
                "Duration": 0,
                "ErrRate": 0,
                "Qps": 0,
                "Type": "virtual",
                "Color": "",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "User_tingyun-java-user-service",
                "Weight": 1,
                "Source": "User",
                "Target": "tingyun-java-user-service",
                "Duration": 0,
                "ErrRate": 0,
                "Qps": 0,
                "Type": "virtual",
                "Color": "",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "User_order-service",
                "Weight": 1,
                "Source": "User",
                "Target": "order-service",
                "Duration": 0,
                "ErrRate": 0,
                "Qps": 0,
                "Type": "virtual",
                "Color": "",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "User_user-service",
                "Weight": 1,
                "Source": "User",
                "Target": "user-service",
                "Duration": 0,
                "ErrRate": 0,
                "Qps": 0,
                "Type": "virtual",
                "Color": "",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "User_delivery-service",
                "Weight": 1,
                "Source": "User",
                "Target": "delivery-service",
                "Duration": 0,
                "ErrRate": 0,
                "Qps": 0,
                "Type": "virtual",
                "Color": "",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "User_market-service",
                "Weight": 1,
                "Source": "User",
                "Target": "market-service",
                "Duration": 0,
                "ErrRate": 0,
                "Qps": 0,
                "Type": "virtual",
                "Color": "",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "User_tingyun-java-order-service",
                "Weight": 1,
                "Source": "User",
                "Target": "tingyun-java-order-service",
                "Duration": 0,
                "ErrRate": 0,
                "Qps": 0,
                "Type": "virtual",
                "Color": "",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            },
            {
                "Id": "User_tingyun-java-market-service",
                "Weight": 1,
                "Source": "User",
                "Target": "tingyun-java-market-service",
                "Duration": 0,
                "ErrRate": 0,
                "Qps": 0,
                "Type": "virtual",
                "Color": "",
                "SqlRequestCount": 0,
                "SqlErrorRequestCount": 0
            }
        ],
        "Nodes": [
            {
                "Id": "0",
                "Weight": 1,
                "Name": "0",
                "Duration": 4.76,
                "ErrRate": 0,
                "Kind": "",
                "Qps": 13.27,
                "Type": "redis",
                "Size": "small",
                "Color": "green",
                "IsModule": true,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "tingyun-java-market-service",
                "Weight": 1,
                "Name": "tingyun-java-market-service",
                "Duration": 0,
                "ErrRate": 1.718213058419244,
                "Kind": "",
                "Qps": 38.8,
                "Type": "grpcserver",
                "Size": "small",
                "Color": "green",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "tingyun-java-user-service",
                "Weight": 1,
                "Name": "tingyun-java-user-service",
                "Duration": 0,
                "ErrRate": 2.479338842975207,
                "Kind": "",
                "Qps": 32.27,
                "Type": "grpcserver",
                "Size": "small",
                "Color": "green",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "java-order-service",
                "Weight": 1,
                "Name": "java-order-service",
                "Duration": 0,
                "ErrRate": 0,
                "Kind": "",
                "Qps": 0,
                "Type": "",
                "Size": "small",
                "Color": "green",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "order-service",
                "Weight": 1,
                "Name": "order-service",
                "Duration": 227.25,
                "ErrRate": 0,
                "Kind": "",
                "Qps": 318.53,
                "Type": "net/http",
                "Size": "small",
                "Color": "green",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "user-service",
                "Weight": 1,
                "Name": "user-service",
                "Duration": 10.81,
                "ErrRate": 0.07733408323959505,
                "Kind": "",
                "Qps": 948.27,
                "Type": "grpc",
                "Size": "middle",
                "Color": "green",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "java-delivery-service",
                "Weight": 1,
                "Name": "java-delivery-service",
                "Duration": 0,
                "ErrRate": 0,
                "Kind": "",
                "Qps": 0,
                "Type": "",
                "Size": "small",
                "Color": "green",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "mock_project_db",
                "Weight": 1,
                "Name": "mock_project_db",
                "Duration": 7.12,
                "ErrRate": 0.028001792114695338,
                "Kind": "",
                "Qps": 2380.8,
                "Type": "mysql",
                "Size": "bigLarge",
                "Color": "green",
                "IsModule": true,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "java-market-service",
                "Weight": 1,
                "Name": "java-market-service",
                "Duration": 0,
                "ErrRate": 0,
                "Kind": "",
                "Qps": 0,
                "Type": "",
                "Size": "small",
                "Color": "green",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "tingyun-java-stock-service",
                "Weight": 1,
                "Name": "tingyun-java-stock-service",
                "Duration": 0,
                "ErrRate": 3.763440860215054,
                "Kind": "",
                "Qps": 37.2,
                "Type": "grpcserver",
                "Size": "small",
                "Color": "green",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "delivery-service",
                "Weight": 1,
                "Name": "delivery-service",
                "Duration": 29.59,
                "ErrRate": 0,
                "Kind": "",
                "Qps": 319.27,
                "Type": "net/http",
                "Size": "small",
                "Color": "green",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "stock-service",
                "Weight": 1,
                "Name": "stock-service",
                "Duration": 33.19,
                "ErrRate": 0.2915249531477754,
                "Kind": "",
                "Qps": 960.47,
                "Type": "grpc",
                "Size": "middle",
                "Color": "green",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "tingyun-java-delivery-service",
                "Weight": 1,
                "Name": "tingyun-java-delivery-service",
                "Duration": 10.91,
                "ErrRate": 0,
                "Kind": "",
                "Qps": 13.33,
                "Type": "springcontroller",
                "Size": "small",
                "Color": "green",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "User",
                "Weight": 1,
                "Name": "User",
                "Duration": 0,
                "ErrRate": 0,
                "Kind": "",
                "Qps": 0,
                "Type": "virtual",
                "Size": "small",
                "Color": "darkGray",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "market-service",
                "Weight": 1,
                "Name": "market-service",
                "Duration": 17.46,
                "ErrRate": 1.5148371031334302,
                "Kind": "",
                "Qps": 321.27,
                "Type": "grpc",
                "Size": "small",
                "Color": "green",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            },
            {
                "Id": "tingyun-java-order-service",
                "Weight": 1,
                "Name": "tingyun-java-order-service",
                "Duration": 80.74,
                "ErrRate": 23.88059701492537,
                "Kind": "",
                "Qps": 13.4,
                "Type": "springcontroller",
                "Size": "small",
                "Color": "red",
                "IsModule": false,
                "Position": {
                    "X": 0,
                    "Y": 0
                },
                "CanDrillDown": false,
                "Tags": null
            }
        ],
        "RequestId": "aad5307a-d2d7-4d55-a79b-d29938b13b51",
        "Selectors": null,
        "TopologyModifyFlag": 1
    }
}

5. 开发者资源

腾讯云 API 平台

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

API Inspector

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

SDK

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

命令行工具

6. 错误码

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

错误码 描述
FailedOperation 操作失败。
FailedOperation.AppIdNotMatchInstanceInfo AppID 和业务系统信息不匹配。
FailedOperation.FocusNodeNotFound 拓扑图中心节点不存在。
FailedOperation.InstanceIdIsEmpty 业务系统 ID 为空。
FailedOperation.InstanceNotFound APM 业务系统不存在。