Debug K6 HTTP 流量
k6 提供了 --http-debug
选项。开启后,k6 会打印 HTTP 的请求和响应的内容。
--http-debug
只打印 HTTP 请求和响应,不包含 body--http-debug="full"
包含 HTTP body
k6 run script.js --http-debug="full"
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: script.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
INFO[0000] Request:
GET /uuid HTTP/1.1
Host: httpbin.org
User-Agent: k6/0.35.0 (https://k6.io/)
Accept-Encoding: gzip
group= iter=0 request_id=e9889166-77c1-492f-5567-14ebbc3c626f scenario=default source=http-debug vu=1
INFO[0001] Response:
HTTP/2.0 200 OK
Content-Length: 53
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Content-Type: application/json
Date: Thu, 24 Feb 2022 14:14:00 GMT
Server: gunicorn/19.9.0
{
"uuid": "5add2f2f-ab3d-4dcb-b831-ea7830af408e"
}
group= iter=0 request_id=e9889166-77c1-492f-5567-14ebbc3c626f scenario=default source=http-debug vu=1
running (00m01.3s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m01.3s/10m0s 1/1 iters, 1 per VU
✓ is status 200
checks.........................: 100.00% ✓ 1 ✗ 0
data_received..................: 5.8 kB 4.4 kB/s
data_sent......................: 616 B 469 B/s
http_req_blocked...............: avg=979.26ms min=979.26ms med=979.26ms max=979.26ms p(90)=979.26ms p(95)=979.26ms
http_req_connecting............: avg=1.99ms min=1.99ms med=1.99ms max=1.99ms p(90)=1.99ms p(95)=1.99ms
http_req_duration..............: avg=326.81ms min=326.81ms med=326.81ms max=326.81ms p(90)=326.81ms p(95)=326.81ms
{ expected_response:true }...: avg=326.81ms min=326.81ms med=326.81ms max=326.81ms p(90)=326.81ms p(95)=326.81ms
http_req_failed................: 0.00% ✓ 0 ✗ 1
http_req_receiving.............: avg=14.68ms min=14.68ms med=14.68ms max=14.68ms p(90)=14.68ms p(95)=14.68ms
http_req_sending...............: avg=467.8µs min=467.8µs med=467.8µs max=467.8µs p(90)=467.8µs p(95)=467.8µs
http_req_tls_handshaking.......: avg=973.8ms min=973.8ms med=973.8ms max=973.8ms p(90)=973.8ms p(95)=973.8ms
http_req_waiting...............: avg=311.66ms min=311.66ms med=311.66ms max=311.66ms p(90)=311.66ms p(95)=311.66ms
http_reqs......................: 1 0.761538/s
iteration_duration.............: avg=1.31s min=1.31s med=1.31s max=1.31s p(90)=1.31s p(95)=1.31s
iterations.....................: 1 0.761538/s
vus............................: 1 min=1 max=1
vus_max........................: 1 min=1 max=1