fix(perf): make Kova startup diagnostics actionable (#116319)

* fix(perf): rank startup duration hotspots correctly

* ci(perf): exercise prepared runtime startup cases
This commit is contained in:
Vincent Koc
2026-07-31 10:23:32 +08:00
committed by GitHub
parent b6e484e895
commit c3bb8fc265
3 changed files with 18 additions and 1 deletions

View File

@@ -715,6 +715,9 @@ jobs:
--skip-qa \
--startup-case default \
--startup-case skipChannels \
--startup-case preparedRuntimeCatalogStall \
--startup-case preparedRuntimeScaleOne \
--startup-case preparedRuntimeScaleMany \
--startup-case oneInternalHook \
--startup-case allInternalHooks \
--startup-case fiftyPlugins \

View File

@@ -360,7 +360,7 @@ function buildTraceRows(startup) {
const rows = [];
for (const result of startup?.results ?? []) {
const traceEntries = Object.entries(result.summary?.startupTrace ?? {})
.filter(([, stats]) => typeof stats?.p50 === "number")
.filter(([name, stats]) => isStartupTraceDuration(name) && typeof stats?.p50 === "number")
.toSorted((a, b) => (b[1].p50 ?? 0) - (a[1].p50 ?? 0))
.slice(0, 5);
for (const [name, stats] of traceEntries) {
@@ -370,6 +370,14 @@ function buildTraceRows(startup) {
return rows;
}
function isStartupTraceDuration(name) {
if (name.endsWith(".total") || name.startsWith("memory.")) {
return false;
}
const metricName = name.slice(name.lastIndexOf(".") + 1);
return !metricName.endsWith("Count") && !metricName.endsWith("Mb");
}
function buildMockHelloRows(summaries) {
return summaries.map(({ id, summary }) => {
const status =

View File

@@ -46,6 +46,8 @@ function writeSourceFixture(sourceDir: string) {
cpuCoreRatio: { p95: 0.25 },
startupTrace: {
"memory.ready.heapUsedMb": { p50: 30, p95: 32 },
"phase.load.total": { p50: 70, p95: 80 },
"phase.load.itemCount": { p50: 40, p95: 50 },
"phase.load": { p50: 7, p95: 8 },
},
},
@@ -165,6 +167,10 @@ describe("buildMarkdown", () => {
expect(buildMarkdown(sourceDir, null)).toContain("gateway health json");
expect(buildMarkdown(sourceDir, null)).toContain("## SQLite State Smoke");
expect(buildMarkdown(sourceDir, null)).toContain("4100");
expect(buildMarkdown(sourceDir, null)).toContain("| default | phase.load | 7.0ms | 8.0ms |");
expect(buildMarkdown(sourceDir, null)).not.toContain("phase.load.total");
expect(buildMarkdown(sourceDir, null)).not.toContain("phase.load.itemCount");
expect(buildMarkdown(sourceDir, null)).not.toContain("memory.ready.heapUsedMb");
});
it("rejects a missing source directory", () => {