更新时间:2023-11-21 GMT+08:00
分享

获取趋势图

功能介绍

获取趋势图。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

POST /v1/apm2/openapi/view/metric/trend

请求参数

表1 请求Header参数

参数

是否必选

参数类型

描述

x-business-id

Long

应用id。

X-Auth-Token

String

从IAM服务获取的用户Token。

表2 请求Body参数

参数

是否必选

参数类型

描述

view_config

TrendView object

视图配置信息。

instance_id

Long

实例id。

monitor_item_id

Long

监控项id。

env_id

Long

环境id。

start_time

String

开始时间。

end_time

String

结束时间。

表3 TrendView

参数

是否必选

参数类型

描述

view_type

String

视图类型。

枚举值:

  • trend
  • sumtable
  • rawtable

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

Boolean

跨度。

span_field

String

span字段属性。

order_by

String

排序。

latest

String

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

表4 FieldItem

参数

是否必选

参数类型

描述

function

String

表达式。

as

String

作为。

default_value

String

默认值。

trace

Boolean

是否是trace。

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

值。

请求示例

获取趋势图。入参中,view_type对应的值是trend。

/v1/apm2/openapi/view/metric/trend

{
  "end_time" : "2022-10-25 15:40:00",
  "env_id" : "11",
  "monitor_item_id" : 78,
  "start_time" : "2022-10-25 15:20:00",
  "view_config" : {
    "latest" : null,
    "span" : true,
    "collector_name" : "Url",
    "metric_set" : "url",
    "title" : "调用次数",
    "table_direction" : null,
    "group_by" : "",
    "filter" : "url=/apm2/health/v1/health-check^method=GET",
    "field_item_list" : [ {
      "trace" : null,
      "function" : "SUM(invokeCount)",
      "as" : "调用次数",
      "default_value" : null,
      "precision" : null,
      "unit" : null,
      "visible" : true
    } ],
    "span_field" : "source",
    "view_type" : "trend"
  }
}

响应示例

状态码: 200

OK,请求响应成功。

{
  "line_list" : [ {
    "point_list" : [ {
      "time" : 1666682400000,
      "value" : 8
    }, {
      "time" : 1666682460000,
      "value" : 8
    }, {
      "time" : 1666682520000,
      "value" : 8
    }, {
      "time" : 1666682580000,
      "value" : 8
    }, {
      "time" : 1666682640000,
      "value" : 8
    }, {
      "time" : 1666682700000,
      "value" : 8
    }, {
      "time" : 1666682760000,
      "value" : 8
    }, {
      "time" : 1666682820000,
      "value" : 8
    }, {
      "time" : 1666682880000,
      "value" : 8
    }, {
      "time" : 1666682940000,
      "value" : 8
    }, {
      "time" : 1666683000000,
      "value" : 8
    }, {
      "time" : 1666683060000,
      "value" : 8
    }, {
      "time" : 1666683120000,
      "value" : 8
    }, {
      "time" : 1666683180000,
      "value" : 8
    }, {
      "time" : 1666683240000,
      "value" : 8
    }, {
      "time" : 1666683300000,
      "value" : 8
    }, {
      "time" : 1666683360000,
      "value" : 8
    }, {
      "time" : 1666683420000,
      "value" : null
    }, {
      "time" : 1666683480000,
      "value" : null
    }, {
      "time" : 1666683540000,
      "value" : null
    } ],
    "title" : "调用次数",
    "unit" : null,
    "precision" : null,
    "data_type" : "INT",
    "visible" : true
  } ],
  "latest_data_Time" : 1666683360000
}

状态码

状态码

描述

200

OK,请求响应成功。

400

Bad Request,语义或参数有误。

401

Unauthorized,没有权限

403

Forbidden,禁止访问。

404

Not Found,没有找到要请求的资源。

错误码

请参见错误码

分享:

    相关文档

    相关产品