tested k9 reports
This commit is contained in:
@@ -13,8 +13,31 @@ const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
// ── Parse args ────────────────────────────────────────────────────────────────
|
||||
const inputFile = process.argv[2];
|
||||
const outputFile = process.argv[3] || "k6-results/parsed-report.json";
|
||||
const inputFile = process.argv[2];
|
||||
const outputFile = process.argv[3] || "k6-results/parsed-report.json";
|
||||
const benchProfile = process.env.BENCH_PROFILE || "default";
|
||||
const thresholdPreset =
|
||||
benchProfile === "local"
|
||||
? {
|
||||
overallP95: 35000,
|
||||
errorRate: 0.1,
|
||||
sosP95: 3000,
|
||||
locationP95: 3000,
|
||||
obstacleP95: 5000,
|
||||
authP95: 35000,
|
||||
timelineP95: 5000,
|
||||
notificationP95: 5000,
|
||||
}
|
||||
: {
|
||||
overallP95: 500,
|
||||
errorRate: 0.01,
|
||||
sosP95: 200,
|
||||
locationP95: 300,
|
||||
obstacleP95: 400,
|
||||
authP95: 800,
|
||||
timelineP95: 1000,
|
||||
notificationP95: 500,
|
||||
};
|
||||
|
||||
if (!inputFile) {
|
||||
console.error(
|
||||
@@ -102,10 +125,11 @@ function summarizeSeries(arr) {
|
||||
}
|
||||
|
||||
// ── Build structured report ───────────────────────────────────────────────────
|
||||
const report = {
|
||||
generatedAt: new Date().toISOString(),
|
||||
inputFile: path.resolve(inputFile),
|
||||
totalPoints: dataPoints.length,
|
||||
const report = {
|
||||
generatedAt: new Date().toISOString(),
|
||||
inputFile: path.resolve(inputFile),
|
||||
benchProfile,
|
||||
totalPoints: dataPoints.length,
|
||||
parseErrors: errors.length,
|
||||
|
||||
// 5 KEY METRICS sesuai ketentuan pillar 3:
|
||||
@@ -183,12 +207,13 @@ if (report.metrics["http_req_duration"]) {
|
||||
}
|
||||
|
||||
if (report.metrics["http_req_failed"]) {
|
||||
const rate = (
|
||||
parseFloat(report.metrics["http_req_failed"].avg) * 100
|
||||
).toFixed(2);
|
||||
report.keyMetrics.errorRate.value = rate + "%";
|
||||
report.keyMetrics.errorRate.passFail = parseFloat(rate) < 1 ? "PASS" : "FAIL";
|
||||
}
|
||||
const rate = (
|
||||
parseFloat(report.metrics["http_req_failed"].avg) * 100
|
||||
).toFixed(2);
|
||||
report.keyMetrics.errorRate.value = rate + "%";
|
||||
report.keyMetrics.errorRate.passFail =
|
||||
parseFloat(rate) / 100 < thresholdPreset.errorRate ? "PASS" : "FAIL";
|
||||
}
|
||||
|
||||
if (report.metrics["walkguide_jvm_heap_used_mb"]) {
|
||||
report.keyMetrics.jvmHeap.value =
|
||||
@@ -247,72 +272,72 @@ for (const [key, metricName] of Object.entries(wgMetricMap)) {
|
||||
}
|
||||
|
||||
// ── Threshold checks ──────────────────────────────────────────────────────────
|
||||
const thresholdChecks = [
|
||||
{
|
||||
name: "p95 overall < 500ms",
|
||||
metric: "http_req_duration",
|
||||
stat: "p95",
|
||||
threshold: 500,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: "error rate < 1%",
|
||||
metric: "http_req_failed",
|
||||
stat: "avg",
|
||||
threshold: 0.01,
|
||||
unit: "rate",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: "SOS p95 < 200ms",
|
||||
metric: "walkguide_sos_latency_ms",
|
||||
stat: "p95",
|
||||
threshold: 200,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: "Location p95 < 300ms",
|
||||
metric: "walkguide_location_latency_ms",
|
||||
stat: "p95",
|
||||
threshold: 300,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: "Obstacle p95 < 400ms",
|
||||
metric: "walkguide_obstacle_latency_ms",
|
||||
stat: "p95",
|
||||
threshold: 400,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: "Auth p95 < 800ms",
|
||||
metric: "walkguide_auth_latency_ms",
|
||||
stat: "p95",
|
||||
threshold: 800,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: "Timeline p95 < 1000ms",
|
||||
metric: "walkguide_timeline_latency_ms",
|
||||
stat: "p95",
|
||||
threshold: 1000,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: "Notification p95 < 500ms",
|
||||
metric: "walkguide_notif_latency_ms",
|
||||
stat: "p95",
|
||||
threshold: 500,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
];
|
||||
const thresholdChecks = [
|
||||
{
|
||||
name: `p95 overall < ${thresholdPreset.overallP95}ms`,
|
||||
metric: "http_req_duration",
|
||||
stat: "p95",
|
||||
threshold: thresholdPreset.overallP95,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: `error rate < ${thresholdPreset.errorRate * 100}%`,
|
||||
metric: "http_req_failed",
|
||||
stat: "avg",
|
||||
threshold: thresholdPreset.errorRate,
|
||||
unit: "rate",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: `SOS p95 < ${thresholdPreset.sosP95}ms`,
|
||||
metric: "walkguide_sos_latency_ms",
|
||||
stat: "p95",
|
||||
threshold: thresholdPreset.sosP95,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: `Location p95 < ${thresholdPreset.locationP95}ms`,
|
||||
metric: "walkguide_location_latency_ms",
|
||||
stat: "p95",
|
||||
threshold: thresholdPreset.locationP95,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: `Obstacle p95 < ${thresholdPreset.obstacleP95}ms`,
|
||||
metric: "walkguide_obstacle_latency_ms",
|
||||
stat: "p95",
|
||||
threshold: thresholdPreset.obstacleP95,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: `Auth p95 < ${thresholdPreset.authP95}ms`,
|
||||
metric: "walkguide_auth_latency_ms",
|
||||
stat: "p95",
|
||||
threshold: thresholdPreset.authP95,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: `Timeline p95 < ${thresholdPreset.timelineP95}ms`,
|
||||
metric: "walkguide_timeline_latency_ms",
|
||||
stat: "p95",
|
||||
threshold: thresholdPreset.timelineP95,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
{
|
||||
name: `Notification p95 < ${thresholdPreset.notificationP95}ms`,
|
||||
metric: "walkguide_notif_latency_ms",
|
||||
stat: "p95",
|
||||
threshold: thresholdPreset.notificationP95,
|
||||
unit: "ms",
|
||||
operator: "<",
|
||||
},
|
||||
];
|
||||
|
||||
for (const check of thresholdChecks) {
|
||||
const m = report.metrics[check.metric];
|
||||
|
||||
Reference in New Issue
Block a user