xcdn统计
更新时间:2023-11-17
接口
本接口用于查询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时间 |
请求示例
Plain Text
1POST /v2/xcdn/stat/query HTTP/1.1
2Host: cdn.baidubce.com
3
4{
5 "startTime": "2023-04-12T10:00:00Z",
6 "endTime": "2023-04-13T10:00:00Z",
7 "period": 3600,
8 "metric": "flow",
9 "groupByKey":true,
10 "productType": "xcdn-sdk",
11 "keys": [
12 "test.baidu.com"
13 ]
14}
响应示例
Plain Text
1HTTP/1.1 200 OK
2Server: nginx/1.16.1
3Date:Fri, 14 Apr 2023 09:23:57 GMT
4Content-Type: application/json; charset=utf-8
5Transfer-Encoding: chunked
6Connection: keep-alive
7X-Powered-By: PHP/7.1.15
8x-bce-request-id: 91505d6e-4a9b-c10a-4187-bf7ffcd50ea
9
10{
11 "status": "ok",
12 "details": [
13 {
14 "timestamp": "2023-04-12T10:00:00Z",
15 "key": "test.baidu.com",
16 "flow": 19882,
17 "bps": 44
18 },
19 {
20 "timestamp": "2023-04-12T11:00:00Z",
21 "key": "test.baidu.com",
22 "flow": 20651,
23 "bps": 45
24 },
25 {
26 "timestamp": "2023-04-12T12:00:00Z",
27 "key": "test.baidu.com",
28 "flow": 12800,
29 "bps": 28
30 },
31 {
32 "timestamp": "2023-04-12T13:00:00Z",
33 "key": "test.baidu.com",
34 "flow": 16559,
35 "bps": 36
36 },
37 {
38 "timestamp": "2023-04-12T14:00:00Z",
39 "key": "test.baidu.com",
40 "flow": 19611,
41 "bps": 43
42 },
43 {
44 "timestamp": "2023-04-12T15:00:00Z",
45 "key": "test.baidu.com",
46 "flow": 16877,
47 "bps": 37
48 },
49 {
50 "timestamp": "2023-04-12T16:00:00Z",
51 "key": "test.baidu.com",
52 "flow": 33426,
53 "bps": 74
54 },
55 {
56 "timestamp": "2023-04-12T17:00:00Z",
57 "key": "test.baidu.com",
58 "flow": 27513,
59 "bps": 61
60 },
61 {
62 "timestamp": "2023-04-12T18:00:00Z",
63 "key": "test.baidu.com",
64 "flow": 34756,
65 "bps": 77
66 },
67 {
68 "timestamp": "2023-04-12T19:00:00Z",
69 "key": "test.baidu.com",
70 "flow": 30811,
71 "bps": 68
72 },
73 {
74 "timestamp": "2023-04-12T20:00:00Z",
75 "key": "test.baidu.com",
76 "flow": 34372,
77 "bps": 76
78 },
79 {
80 "timestamp": "2023-04-12T21:00:00Z",
81 "key": "test.baidu.com",
82 "flow": 46220,
83 "bps": 102
84 },
85 {
86 "timestamp": "2023-04-12T22:00:00Z",
87 "key": "test.baidu.com",
88 "flow": 31795,
89 "bps": 70
90 },
91 {
92 "timestamp": "2023-04-12T23:00:00Z",
93 "key": "test.baidu.com",
94 "flow": 29757,
95 "bps": 66
96 },
97 {
98 "timestamp": "2023-04-13T00:00:00Z",
99 "key": "test.baidu.com",
100 "flow": 29448,
101 "bps": 65
102 },
103 {
104 "timestamp": "2023-04-13T01:00:00Z",
105 "key": "test.baidu.com",
106 "flow": 32179,
107 "bps": 71
108 },
109 {
110 "timestamp": "2023-04-13T02:00:00Z",
111 "key": "test.baidu.com",
112 "flow": 30548,
113 "bps": 67
114 },
115 {
116 "timestamp": "2023-04-13T03:00:00Z",
117 "key": "test.baidu.com",
118 "flow": 27476,
119 "bps": 61
120 },
121 {
122 "timestamp": "2023-04-13T04:00:00Z",
123 "key": "test.baidu.com",
124 "flow": 21258,
125 "bps": 47
126 },
127 {
128 "timestamp": "2023-04-13T05:00:00Z",
129 "key": "test.baidu.com",
130 "flow": 30985,
131 "bps": 68
132 },
133 {
134 "timestamp": "2023-04-13T06:00:00Z",
135 "key": "test.baidu.com",
136 "flow": 31801,
137 "bps": 70
138 },
139 {
140 "timestamp": "2023-04-13T07:00:00Z",
141 "key": "test.baidu.com",
142 "flow": 34067,
143 "bps": 75
144 },
145 {
146 "timestamp": "2023-04-13T08:00:00Z",
147 "key": "test.baidu.com",
148 "flow": 24996,
149 "bps": 55
150 },
151 {
152 "timestamp": "2023-04-13T09:00:00Z",
153 "key": "test.baidu.com",
154 "flow": 20546,
155 "bps": 45
156 }
157 ],
158 "count": 24,
159 "summary": {
160 "totalFlow": 658334,
161 "peakBandwidth": 102
162 },
163 "days": [
164 {
165 "date": "2023-04-12",
166 "totalFlow": 106380,
167 "peakBandwidth": 45,
168 "peakBandwidthTime": "2023-04-12T11:00:00Z"
169 },
170 {
171 "date": "2023-04-13",
172 "totalFlow": 551954,
173 "peakBandwidth": 102,
174 "peakBandwidthTime": "2023-04-12T21:00:00Z"
175 }
176 ]
177}
接口
本接口用于查询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格式 |
请求示例
Plain Text
1POST /v2/xcdn/stat/billing HTTP/1.1
2Host: cdn.baidubce.com
3
4{
5 "domains" : [
6 "test.baidu.com"
7 ],
8 "startTime": "2023-04-12T10:00:00Z",
9 "endTime": "2023-04-13T10:00:00Z",
10 "productType": "xcdn-sdk"
11}
响应示例
Plain Text
1HTTP/1.1 200 OK
2Server: nginx/1.16.1
3Fri, 14 Apr 2023 09:58:30 GMT
4Content-Type: application/json; charset=utf-8
5Transfer-Encoding: chunked
6Connection: keep-alive
7X-Powered-By: PHP/7.1.15
8x-bce-request-id: c6993174-1d52-ad10-d81a-7d46a804049b
9
10{
11 "billingDetails": {
12 "billBand": 135,
13 "billTime": "2023-04-12T18:35:00Z"
14 }
15}