You need to enable JavaScript to run this app.
导航

ResourceTiming

最近更新时间2023.12.26 18:54:56

首次发布时间2022.11.18 15:32:34

调用ResourceTiming接口获取资源加载耗时甘特图。

使用说明

  • 接口名称:ResourceTiming
  • 请求方式:POST
  • 接口地址:/?Action=ResourceTiming&Version=2022-10-12

请求参数

Query

参数

类型

是否必选

示例值

描述

Action

String

ResourceTiming

请求名称。

Version

String

2022-10-12

请求版本。

ServiceName : apmplus_openapi
Region : cn-beijing 
X-App-Ids : xxx
Content-Type : application/json

Body

参数

类型

是否必选

示例值

描述

common

object of common

-

通用参数。

time_filter

object of time_filter

-

时间区间。

event_id

string

http:[web_monitor]{webpro#session#649b8a7b-5db4-4989-b9a5-994e53da82ee#187277}:1663186696013#fc102ce5612345edb2bd00163e352627

上报数据的唯一标识,从DataList.MetricMap中获取。

common

参数

类型

是否必选

示例值

描述

aid

i64

12345

应用ID。

site_type

string

web

站点类型。

env

string

online

环境,填""时为全部。

os

string

webpro

服务类型,可选值为webproappminipro

user

string

test_user

用户名。

time_filter

参数

类型

是否必选

示例值

描述

start_time

i32

1665485413

起始时间,单位s。

granularity

i32

3600

聚合时间粒度,单位s。

end_time

i32

1665744613

终止时间,单位s。

返回参数

参数

类型

示例值

描述

data

object of data

-

资源耗时加载甘特图。

error_msg

string

-

错误信息,成功为空。

error_no

i32

0

错误码,成功为0。

data

参数

类型

示例值

描述

fields

array of fields

-

折线图/饼图维度,len(fields)=len(source[i])。

source

array of string

[["1668355200","js_error","0","0"]]

趋势图具体点的集合,len(source)为折线图点的数量或者饼图中块数量。

fields

参数

类型

示例值

描述

id

string

date

维度key。

dataType

string

string

维度类型。

name

string

日期

维度名。

aggregate

string

-

聚合方式。

请求示例

POST https://open.volcengineapi.com/?Action=ResourceTiming&Version=2022-10-12 
{
    "common": {
        "aid": 12345,
        "site_type": "web",
        "env": "online",
        "user": "test_user",
        "os": "webpro"
    },
    "time_filter": {
        "start_time": 1665485413,
        "end_time": 1665744613,
        "granularity": 3600
    },
    "event_id": "http:[web_monitor]{webpro#session#649b8a7b-5db4-4989-b9a5-994e53da82ee#187277}:1663186696013#fc102ce5612345edb2bd00163e352627"
}

返回示例

正常返回示例

{
    "error_no": 0,
    "data": {
        "source": [
            [
                "1668355200",
                "js_error",
                "0",
                "0"
            ]
        ],
        "fields": [
            {
                "aggregate": "",
                "name": "日期",
                "id": "date",
                "dataType": "string"
            }
        ]
    },
    "error_msg": ""
}

异常返回示例

{
    "ResponseMetadata": {
        "RequestId": "201806041104200100100232280022D30",
        "Action": "ResourceTiming",
        "Version": "2022-10-12",
        "Service": "***",
        "Region": "cn-north-1",
        "Error": {
            "Code": "200000",
            "Message": "参数异常"
        }
    }
}