文档首页/ 应用性能管理 APM/ API参考(2.0)/ API/ 链路追踪/ 查询链路追踪指标趋势图(V2) - ShowSkywalkingMetricTrend
更新时间:2026-03-05 GMT+08:00
分享

查询链路追踪指标趋势图(V2) - ShowSkywalkingMetricTrend

功能介绍

查询链路追踪趋势图。

调用方法

请参见如何调用API

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。

  • 如果使用角色与策略授权,具体权限要求请参见权限和授权项
  • 如果使用身份策略授权,需具备如下身份策略权限。

    授权项

    访问级别

    资源类型(*为必须)

    条件键

    别名

    依赖的授权项

    apm::getConf

    Read

    -

    -

    • apm:apm2BusinessView:get
    • apm:apm2Service:get

    -

URI

POST /v2/view/sw/metric/trend

请求参数

表1 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

从IAM服务获取的用户Token。

x-business-id

Long

应用id。

表2 请求Body参数

参数

是否必选

参数类型

描述

instance_id

Long

实例id。

monitor_item_id

Long

监控项id。

env_id

Long

环境id。

start_time

String

开始时间,毫秒级时间戳。

end_time

String

结束时间,毫秒级时间戳。

view_config

TrendView object

视图配置信息。

表3 TrendView

参数

是否必选

参数类型

描述

span

Boolean

跨度。

latest

Boolean

是否只展示最近一笔数据。

collector_name

String

采集器名称。

metric_set

String

视图对应的指标集名称。

title

String

图标所需展示的标题。

table_direction

String

表格的方向,H:默认,表头横向,V:表头纵向。

枚举值:

H

V

group_by

String

分组。

filter

String

过滤列表模型。

field_item_list

Array of FieldItem objects

所需展示的字段列表模型列表。

span_field

String

span字段属性。

view_type

String

视图类型。

表4 FieldItem

参数

是否必选

参数类型

描述

trace

Boolean

是否是trace。

function

String

表达式。

as

String

名称。

default_value

String

默认值。

precision

Integer

百分比。

unit

String

单位。

visible

Boolean

是否可见。

响应参数

状态码:200

表5 响应Body参数

参数

参数类型

描述

line_list

Array of FrontLine objects

数据行列表。

latest_data_Time

Long

最近一笔数据的时间。

表6 FrontLine

参数

参数类型

描述

point_list

Array of FrontPoint objects

数据点集合。

title

String

标题。

unit

String

单位。

precision

Integer

百分比。

data_type

String

日期类型。

visible

Boolean

是否可见。

表7 FrontPoint

参数

参数类型

描述

time

Long

时间。

value

Object

值。

请求示例

/v2/view/sw/metric/trend

{
    "end_time": 1767776243423,
    "env_id": "1628822",
    "start_time": 1767775943423,
    "view_config": {
        "collector_name": "swRpcClient",
        "metric_set": "swRpcServer.total",
        "title": "服务端概览",
        "filter": "",
        "field_item_list": [
        ],
        "view_type": "trend"
    }
}

响应示例

状态码:200

OK

{
  "line_list" : [ {
    "point_list" : [ {
      "time" : 1767775920000
    }, {
      "time" : 1767775980000,
      "value" : 8
    }, {
      "time" : 1767776040000,
      "value" : 2
    }, {
      "time" : 1767776100000
    }, {
      "time" : 1767776160000
    }, {
      "time" : 1767776220000
    } ],
    "title" : "调用次数",
    "data_type" : "INT",
    "visible" : true
  }, {
    "point_list" : [ {
      "time" : 1767775920000
    }, {
      "time" : 1767775980000,
      "value" : 129873.625
    }, {
      "time" : 1767776040000,
      "value" : 130331
    }, {
      "time" : 1767776100000
    }, {
      "time" : 1767776160000
    }, {
      "time" : 1767776220000
    } ],
    "title" : "平均耗时(ms)",
    "data_type" : "DOUBLE",
    "visible" : true
  }, {
    "point_list" : [ {
      "time" : 1767775920000
    }, {
      "time" : 1767775980000,
      "value" : 132267
    }, {
      "time" : 1767776040000,
      "value" : 131713
    }, {
      "time" : 1767776100000
    }, {
      "time" : 1767776160000
    }, {
      "time" : 1767776220000
    } ],
    "title" : "最大耗时(ms)",
    "data_type" : "INT",
    "visible" : true
  }, {
    "point_list" : [ {
      "time" : 1767775920000
    }, {
      "time" : 1767775980000,
      "value" : 8
    }, {
      "time" : 1767776040000,
      "value" : 2
    }, {
      "time" : 1767776100000
    }, {
      "time" : 1767776160000
    }, {
      "time" : 1767776220000
    } ],
    "title" : "错误次数",
    "data_type" : "INT",
    "visible" : true
  } ],
  "latest_data_Time" : 0
}

状态码

状态码

描述

200

OK。

400

Bad Request。

403

Forbidden。

429

Too Many Requests。

错误码

请参见错误码

相关文档