feat: add metrics, observability, test fixtures, and scaling playbook artifacts
This commit is contained in:
1 parent
926a663c23
commit
f9aba11b90
32 files changed
+1788
-124
No files matched your search
@@ -0,0 +1,58 @@
|
||||
import http from "k6/http";
|
||||
import { check, sleep } from "k6";
|
||||
|
||||
const baseUrl = __ENV.ADMIN_BASE_URL || "https://linearvoid.tv";
|
||||
const adminCookie = __ENV.ADMIN_SESSION_COOKIE || "";
|
||||
const requestParams = adminCookie ? { headers: { Cookie: adminCookie } } : {};
|
||||
|
||||
const endpoints = [
|
||||
{ name: "overview", path: "/api/admin/overview" },
|
||||
{ name: "analytics", path: "/api/admin/analytics" },
|
||||
{ name: "chat_log", path: "/api/admin/chat-log" },
|
||||
{ name: "users", path: "/api/admin/users" },
|
||||
];
|
||||
|
||||
export const options = {
|
||||
stages: [
|
||||
{ duration: "30s", target: 10 },
|
||||
{ duration: "60s", target: 50 },
|
||||
{ duration: "60s", target: 100 },
|
||||
{ duration: "30s", target: 0 },
|
||||
],
|
||||
thresholds: {
|
||||
http_req_duration: ["p(95)<1000"],
|
||||
http_req_failed: ["rate<0.01"],
|
||||
"http_req_duration{endpoint:overview}": ["p(95)<1000"],
|
||||
"http_req_duration{endpoint:analytics}": ["p(95)<1000"],
|
||||
"http_req_duration{endpoint:chat_log}": ["p(95)<1000"],
|
||||
"http_req_duration{endpoint:users}": ["p(95)<1000"],
|
||||
"http_req_failed{endpoint:overview}": ["rate<0.01"],
|
||||
"http_req_failed{endpoint:analytics}": ["rate<0.01"],
|
||||
"http_req_failed{endpoint:chat_log}": ["rate<0.01"],
|
||||
"http_req_failed{endpoint:users}": ["rate<0.01"],
|
||||
},
|
||||
};
|
||||
|
||||
export default function () {
|
||||
const requests = endpoints.map((endpoint) => [
|
||||
"GET",
|
||||
`${baseUrl}${endpoint.path}`,
|
||||
null,
|
||||
{
|
||||
...requestParams,
|
||||
tags: {
|
||||
endpoint: endpoint.name,
|
||||
},
|
||||
},
|
||||
]);
|
||||
const responses = http.batch(requests);
|
||||
|
||||
responses.forEach((response, index) => {
|
||||
const endpointPath = endpoints[index].path;
|
||||
check(response, {
|
||||
[`status is 200 for ${endpointPath}`]: (r) => r.status === 200,
|
||||
});
|
||||
});
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
Reference in new issue
Block a user