xcdn统计
更新时间:2023-02-22
接口
本接口用于查询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,0:域名,1:userId,默认值为0 |
key | 可选 | []string | 域名或userId,最多只能查询100个域名,查询userId时只能查询当前账号 |
groupByKey | 可选 | boolean | 查询结果是否根据key聚合,true返回按照key聚合后的结果,false返回整体结果,默认值为false |
productType | 必选 | string | 合法值为xcdn、cdn或者all,分别表示查询xcdn统计,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 | 流量 |
bps | int | 带宽 |
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
User-Agent: curl/7.73.0
Accept: */*
Authorization: xxx
x-bce-date: 2022-07-11T11:00:35Z
x-bce-request-id: 1d9d97be-a9f9-4797-ad86-78949ced2200
Content-Length: 241
Content-Type: application/json
{
"startTime": "2022-02-01T03:00:00Z",
"endTime": "2022-02-02T03:00:00Z",
"period": 3600,
"metric": "flow",
"keys": [
"test.baidu.com"
],
"keyType": 0,
"groupByKey": true,
"productType": "xcdn"
}
响应示例
HTTP/1.1 200 OK
Server: nginx/1.1.10
Date: Mon, 11 Jul 2022 11:00:36 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/7.2.28
x-bce-request-id: 1d9d97be-a9f9-4797-ad86-78949ced2200
{
"status":"ok",
"details":[
{
"timestamp":"2022-02-01T03:00:00Z",
"key":"test.baidu.com",
"flow":6662483127635,
"bps":14805518061
},
{
"timestamp":"2022-02-01T04:00:00Z",
"key":"test",
"flow":7354195756322,
"bps":16342657236
},
{
"timestamp":"2022-02-01T05:00:00Z",
"key":"test.baidu.com",
"flow":8009595629497,
"bps":17799101398
},
{
"timestamp":"2022-02-01T06:00:00Z",
"key":"test.baidu.com",
"flow":8461090090772,
"bps":18802422423
},
{
"timestamp":"2022-02-01T07:00:00Z",
"key":"test.baidu.com",
"flow":8004396070022,
"bps":17787546822
},
{
"timestamp":"2022-02-01T08:00:00Z",
"key":"test.baidu.com",
"flow":7531125991360,
"bps":16735835536
},
{
"timestamp":"2022-02-01T09:00:00Z",
"key":"test.baidu.com",
"flow":6986746053699,
"bps":15526102341
},
{
"timestamp":"2022-02-01T10:00:00Z",
"key":"test.baidu.com",
"flow":6764288925115,
"bps":15031753166
},
{
"timestamp":"2022-02-01T11:00:00Z",
"key":"test.baidu.com",
"flow":6979116103900,
"bps":15509146897
},
{
"timestamp":"2022-02-01T12:00:00Z",
"key":"test.baidu.com",
"flow":6907568249008,
"bps":15350151664
},
{
"timestamp":"2022-02-01T13:00:00Z",
"key":"test.baidu.com",
"flow":6179912649765,
"bps":13733139221
},
{
"timestamp":"2022-02-01T14:00:00Z",
"key":"test.baidu.com",
"flow":4949171133590,
"bps":10998158074
},
{
"timestamp":"2022-02-01T15:00:00Z",
"key":"test.baidu.com",
"flow":3670918726776,
"bps":8157597170
},
{
"timestamp":"2022-02-01T16:00:00Z",
"key":"test.baidu.com",
"flow":2971506961111,
"bps":6603348802
},
{
"timestamp":"2022-02-01T17:00:00Z",
"key":"test.baidu.com",
"flow":2206218485862,
"bps":4902707746
},
{
"timestamp":"2022-02-01T18:00:00Z",
"key":"test.baidu.com",
"flow":1880205198488,
"bps":4178233774
},
{
"timestamp":"2022-02-01T19:00:00Z",
"key":"test.baidu.com",
"flow":1620717543431,
"bps":3601594540
},
{
"timestamp":"2022-02-01T20:00:00Z",
"key":"test.baidu.com",
"flow":1467980546563,
"bps":3262178992
},
{
"timestamp":"2022-02-01T21:00:00Z",
"key":"test.baidu.com",
"flow":1484798291720,
"bps":3299551759
},
{
"timestamp":"2022-02-01T22:00:00Z",
"key":"test.baidu.com",
"flow":1505852947846,
"bps":3346339884
},
{
"timestamp":"2022-02-01T23:00:00Z",
"key":"test.baidu.com",
"flow":1416363270873,
"bps":3147473935
},
{
"timestamp":"2022-02-02T00:00:00Z",
"key":"test.baidu.com",
"flow":2257790301440,
"bps":5017311780
},
{
"timestamp":"2022-02-02T01:00:00Z",
"key":"test.baidu.com",
"flow":3868894036691,
"bps":8597542303
},
{
"timestamp":"2022-02-02T02:00:00Z",
"key":"test.baidu.com",
"flow":5118674198359,
"bps":11374831551
}
],
"count":24,
"summary":{
"totalFlow":114259610289845,
"peakBandwidth":18802422423
},
"days":[
{
"date":"2022-02-01",
"totalFlow":88460608507461,
"peakBandwidth":18802422423,
"peakBandwidthTime":"2022-02-01T06:00:00Z"
},
{
"date":"2022-02-02",
"totalFlow":25799001782384,
"peakBandwidth":11374831551,
"peakBandwidthTime":"2022-02-02T02:00:00Z"
}
]
}
接口
本接口用于查询xcdn月95峰值带宽。
Method | Path | 说明 |
---|---|---|
POST | /v2/xcdn/stat/billing | xcdn月95峰值带宽查询 |
请求体
参数 | 可选 | 类型 | 说明 |
---|---|---|---|
domains | 可选 | list<String> | 查询的域名列表,当该列表为空是查询该用户的所有域名的数据 |
endTime | 可选 | timestamp | 结束时间,UTC格式。默认值为当前时间 |
startTime | 可选 | timestamp | 开始时间,UTC格式。默认值为当前时间前24小时 |
响应体
参数 | 可选 | 类型 | 说明 |
---|---|---|---|
billingDetails | 必选 | billingDetail | 查询的数据 |
billingDetail 类型说明
参数 | 可选 | 类型 | 说明 |
---|---|---|---|
billBand | 必选 | int | 95峰值带宽值 |
billTime | 必选 | string | 该数据点的时间 |
请求示例
POST /v2/xcdn/stat/billing HTTP/1.1
Host: cdn.baidubce.com
{
"domains" : [
"test.baidu.com"
],
"startTime": "2023-02-15T01:00:00Z",
"endTime": "2023-02-15T02:00:00Z"
}
响应示例
HTTP/1.1 200 OK
Server: nginx
Wed, 15 Feb 2023 11:43:45 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: 9bcf123d-4004-8e59-2cf8-e46df2853364
{
"billingDetails": {
"billBand": 64525,
"billTime": "2023-02-15T01:15:00Z"
}
}