xcdn统计
所有文档
menu

内容分发网络 CDN

xcdn统计

产品详情立即购买

接口

本接口用于查询XCDN带宽流量统计信息。

Method Path 说明
POST /v2/xcdn/stat/query 查询XCDN统计,不同的统计指标由post参数中的metric指定

请求体

所有metric支持的参数以此进行扩展。

参数 可选 类型 说明
metric 必选 string 指定查询统计指标类型,当前只支持metric为flow的查询,对应的指标有流量和带宽
endTime 可选 timestamp 查询的时间范围结束值,默认为当前时间,时间跨度最长90天。UTC时间
startTime 可选 timestamp 查询的时间范围起始值,默认为endTime前推24小时。UTC时间
period 可选 int 查询结果的粒度,单位秒,可选值为60、300、3600、86400,默认值为300
keyType 可选 int 标识keys内容,可选值为0、1,分别表示域名、userId,默认值为0
keys 可选 []string 域名或userId,最多只能查询100个域名,查询userId时只能查询当前账号(keyType=1时,keys为空)
groupByKey 可选 boolean 查询结果是否根据key聚合,true返回按照key聚合后的结果,false返回整体结果,默认值为false
productType 可选 string 合法值为xcdn-302、xcdn-sdk、xcdn、cdn、all,分别表示查询xcdn-302统计、xcdn-sdk统计、xcdn统计(302+sdk),cdn统计、xcdn+cdn统计数据,默认值为xcdn

响应体

参数 类型 说明
status string 正常返回的时候为"ok"
count int details中打点数据条数
details []DetailItem 统计打点数据
summary Summary 请求时间段内的总流量和峰值带宽
days []DayInfo 请求时间段内按天分割的总流量和峰值带宽

DetailItem 类型如下

参数 类型 说明
timestamp timestamp 时间点。UTC时间
key string 数据聚合粒度,值为域名、userId或者total,分别表示按照域名聚合数据,按照userId聚合数据以及求和数据
flow int 流量,单位:B
bps int 带宽,单位:bps

Summary 类型如下

参数 类型 说明
totalFlow int 请求时段的总流量
peakBandwidth int 请求时段的峰值带宽

DayInfo 类型如下

参数 类型 说明
date string YYYY-MM-DD格式北京时间
totalFlow int date时间段内的总流量
peakBandwidth int date时间段内的峰值带宽
peakBandwidthTime string YYYY-MM-DDTHH:mm:ssZ格式UTC时间

请求示例

POST /v2/xcdn/stat/query HTTP/1.1
Host: cdn.baidubce.com

{
  "startTime": "2023-04-12T10:00:00Z",
  "endTime": "2023-04-13T10:00:00Z",
  "period": 3600,
  "metric": "flow",
  "groupByKey":true,
  "productType": "xcdn-sdk",
  "keys": [
    "test.baidu.com"
  ]
}

响应示例

HTTP/1.1 200 OK
Server: nginx/1.16.1
Date:Fri, 14 Apr 2023 09:23:57 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/7.1.15
x-bce-request-id: 91505d6e-4a9b-c10a-4187-bf7ffcd50ea

{
    "status": "ok",
    "details": [
        {
            "timestamp": "2023-04-12T10:00:00Z",
            "key": "test.baidu.com",
            "flow": 19882,
            "bps": 44
        },
        {
            "timestamp": "2023-04-12T11:00:00Z",
            "key": "test.baidu.com",
            "flow": 20651,
            "bps": 45
        },
        {
            "timestamp": "2023-04-12T12:00:00Z",
            "key": "test.baidu.com",
            "flow": 12800,
            "bps": 28
        },
        {
            "timestamp": "2023-04-12T13:00:00Z",
            "key": "test.baidu.com",
            "flow": 16559,
            "bps": 36
        },
        {
            "timestamp": "2023-04-12T14:00:00Z",
            "key": "test.baidu.com",
            "flow": 19611,
            "bps": 43
        },
        {
            "timestamp": "2023-04-12T15:00:00Z",
            "key": "test.baidu.com",
            "flow": 16877,
            "bps": 37
        },
        {
            "timestamp": "2023-04-12T16:00:00Z",
            "key": "test.baidu.com",
            "flow": 33426,
            "bps": 74
        },
        {
            "timestamp": "2023-04-12T17:00:00Z",
            "key": "test.baidu.com",
            "flow": 27513,
            "bps": 61
        },
        {
            "timestamp": "2023-04-12T18:00:00Z",
            "key": "test.baidu.com",
            "flow": 34756,
            "bps": 77
        },
        {
            "timestamp": "2023-04-12T19:00:00Z",
            "key": "test.baidu.com",
            "flow": 30811,
            "bps": 68
        },
        {
            "timestamp": "2023-04-12T20:00:00Z",
            "key": "test.baidu.com",
            "flow": 34372,
            "bps": 76
        },
        {
            "timestamp": "2023-04-12T21:00:00Z",
            "key": "test.baidu.com",
            "flow": 46220,
            "bps": 102
        },
        {
            "timestamp": "2023-04-12T22:00:00Z",
            "key": "test.baidu.com",
            "flow": 31795,
            "bps": 70
        },
        {
            "timestamp": "2023-04-12T23:00:00Z",
            "key": "test.baidu.com",
            "flow": 29757,
            "bps": 66
        },
        {
            "timestamp": "2023-04-13T00:00:00Z",
            "key": "test.baidu.com",
            "flow": 29448,
            "bps": 65
        },
        {
            "timestamp": "2023-04-13T01:00:00Z",
            "key": "test.baidu.com",
            "flow": 32179,
            "bps": 71
        },
        {
            "timestamp": "2023-04-13T02:00:00Z",
            "key": "test.baidu.com",
            "flow": 30548,
            "bps": 67
        },
        {
            "timestamp": "2023-04-13T03:00:00Z",
            "key": "test.baidu.com",
            "flow": 27476,
            "bps": 61
        },
        {
            "timestamp": "2023-04-13T04:00:00Z",
            "key": "test.baidu.com",
            "flow": 21258,
            "bps": 47
        },
        {
            "timestamp": "2023-04-13T05:00:00Z",
            "key": "test.baidu.com",
            "flow": 30985,
            "bps": 68
        },
        {
            "timestamp": "2023-04-13T06:00:00Z",
            "key": "test.baidu.com",
            "flow": 31801,
            "bps": 70
        },
        {
            "timestamp": "2023-04-13T07:00:00Z",
            "key": "test.baidu.com",
            "flow": 34067,
            "bps": 75
        },
        {
            "timestamp": "2023-04-13T08:00:00Z",
            "key": "test.baidu.com",
            "flow": 24996,
            "bps": 55
        },
        {
            "timestamp": "2023-04-13T09:00:00Z",
            "key": "test.baidu.com",
            "flow": 20546,
            "bps": 45
        }
    ],
    "count": 24,
    "summary": {
        "totalFlow": 658334,
        "peakBandwidth": 102
    },
    "days": [
        {
            "date": "2023-04-12",
            "totalFlow": 106380,
            "peakBandwidth": 45,
            "peakBandwidthTime": "2023-04-12T11:00:00Z"
        },
        {
            "date": "2023-04-13",
            "totalFlow": 551954,
            "peakBandwidth": 102,
            "peakBandwidthTime": "2023-04-12T21:00:00Z"
        }
    ]
}

接口

本接口用于查询XCDN月95峰值带宽。

Method Path 说明
POST /v2/xcdn/stat/billing XCDN月95峰值带宽查询

请求体

参数 可选 类型 说明
domains 可选 []string 查询的域名列表,当该列表为空是查询该用户的所有域名的数据
endTime 可选 timestamp 查询的时间范围结束值,默认为当前时间,时间跨度最长90天。UTC时间
startTime 可选 timestamp 查询的时间范围起始值,默认为endTime前推24小时。UTC时间
productType 可选 string 合法值为xcdn-302、xcdn-sdk、xcdn、cdn、all,分别表示查询xcdn-302统计、xcdn-sdk统计、xcdn统计(302+sdk),cdn统计、xcdn+cdn统计数据,默认值为xcdn

响应体

参数 可选 类型 说明
billingDetails 必选 billingDetail 查询的数据

billingDetail 类型说明

参数 可选 类型 说明
billBand 必选 int 95峰值带宽值
billTime 必选 string 该数据点的时间,UTC格式

请求示例

POST /v2/xcdn/stat/billing HTTP/1.1
Host: cdn.baidubce.com
 
{
  "domains" : [
      "test.baidu.com"
  ],
  "startTime": "2023-04-12T10:00:00Z",
  "endTime": "2023-04-13T10:00:00Z",
  "productType": "xcdn-sdk"
}

响应示例

HTTP/1.1 200 OK
Server: nginx/1.16.1
Fri, 14 Apr 2023 09:58:30 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/7.1.15
x-bce-request-id: c6993174-1d52-ad10-d81a-7d46a804049b

{
    "billingDetails": {
        "billBand": 135,
        "billTime": "2023-04-12T18:35:00Z"
    }
}
上一篇
上行流量峰值
下一篇
用量查询接口