feat(workbench): add metadata-only session detail

This commit is contained in:
root
2026-07-02 17:07:22 +00:00
parent 1374adf824
commit d1a25f829f
11 changed files with 139 additions and 15 deletions
+17 -3
View File
@@ -359,10 +359,10 @@ test("web performance store accepts Workbench UI lifecycle events without high-c
});
test("Workbench UI OTel spans include timeout activity diagnostics without raw trace ids", async () => {
const calls: any[] = [];
const calls: OtelExportRequestForTest[] = [];
const originalFetch = globalThis.fetch;
globalThis.fetch = async (_url: string | URL | Request, init?: RequestInit) => {
calls.push(JSON.parse(String(init?.body ?? "{}")));
calls.push(JSON.parse(String(init?.body ?? "{}")) as OtelExportRequestForTest);
return new Response(null, { status: 200 });
};
try {
@@ -393,7 +393,7 @@ test("Workbench UI OTel spans include timeout activity diagnostics without raw t
assert.equal(result.submitted, 1);
assert.equal(calls.length, 1);
const span = calls[0].resourceSpans[0].scopeSpans[0].spans[0];
const attrs = Object.fromEntries(span.attributes.map((item: any) => [item.key, item.value.stringValue ?? Number(item.value.intValue) ?? item.value.boolValue]));
const attrs = Object.fromEntries(span.attributes.map((item) => [item.key, item.value.stringValue ?? Number(item.value.intValue) ?? item.value.boolValue]));
assert.equal(attrs["http.route"], "/v1/workbench/turns/:id");
assert.equal(attrs["workbench.ui.timeout_name"], "workbench turn");
assert.equal(attrs["workbench.ui.activity_waiting_for"], "code-agent");
@@ -405,6 +405,19 @@ test("Workbench UI OTel spans include timeout activity diagnostics without raw t
}
});
interface OtelExportRequestForTest {
resourceSpans: Array<{
scopeSpans: Array<{
spans: Array<{
attributes: Array<{
key: string;
value: { stringValue?: string; intValue?: string | number; boolValue?: boolean };
}>;
}>;
}>;
}>;
}
test("web performance store drops unsupported Workbench labels and counts series limit drops", () => {
const store = createWebPerformanceStore({ env: { HWLAB_METRICS_NAMESPACE: "hwlab-v03", HWLAB_GITOPS_TARGET: "v03" }, maxSeries: 1 });
const first = store.record({
@@ -449,6 +462,7 @@ test("web performance store filters observability self-noise", () => {
});
test("web performance route templates keep metrics low-cardinality", () => {
assert.equal(webPerformanceRouteTemplate("/v1/workbench/sessions/ses_abcdef?includeMessages=false"), "/v1/workbench/sessions/:id?includeMessages=false");
assert.equal(webPerformanceRouteTemplate("/v1/workbench/sessions/ses_abcdef/messages?traceId=trc_secret"), "/v1/workbench/sessions/:id/messages");
assert.equal(webPerformanceRouteTemplate("#/skills"), "/skills");
});