chore: initial import
This commit is contained in:
32
test/perf/drilldown_k6.js
Normal file
32
test/perf/drilldown_k6.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import http from 'k6/http';
|
||||
import { check, sleep } from 'k6';
|
||||
|
||||
// AI-Ops 下钻性能压测脚本
|
||||
// 目标:验证下钻加载 < 3s,并发 20 用户
|
||||
|
||||
export const options = {
|
||||
stages: [
|
||||
{ duration: '30s', target: 20 },
|
||||
{ duration: '2m', target: 20 },
|
||||
{ duration: '30s', target: 0 },
|
||||
],
|
||||
thresholds: {
|
||||
http_req_duration: ['p(95)<3000'], // P95 < 3s
|
||||
http_req_failed: ['rate<0.01'], // 失败率 < 1%
|
||||
},
|
||||
};
|
||||
|
||||
export default function () {
|
||||
const service = `service_${Math.floor(Math.random() * 10)}`;
|
||||
const url = `http://localhost:8080/api/v1/ai-ops/metrics/drilldown?service=${service}&window=5m`;
|
||||
const res = http.get(url, {
|
||||
headers: { 'Authorization': 'Bearer ${__ENV.AI_OPS_TOKEN}' },
|
||||
});
|
||||
|
||||
check(res, {
|
||||
'status is 200': (r) => r.status === 200,
|
||||
'response time < 3s': (r) => r.timings.duration < 3000,
|
||||
});
|
||||
|
||||
sleep(2);
|
||||
}
|
||||
Reference in New Issue
Block a user