add clickhouse alert context hydration for alert drawers

This commit is contained in:
dirtydishes 2026-05-17 20:18:01 -04:00
parent cd0a1dd9e5
commit 58e57fad6e
5 changed files with 153 additions and 9 deletions

View file

@ -53,6 +53,7 @@ import {
fetchSmartMoneyEventsBefore,
fetchFlowPacketsAfter,
fetchFlowPacketById,
fetchAlertContextByTraceId,
fetchFlowPacketsByMemberTraceIds,
fetchFlowPacketsBefore,
fetchRecentAlerts,
@ -1591,6 +1592,17 @@ const run = async () => {
return jsonResponse({ data });
}
if (req.method === "GET" && /^\/flow\/alerts\/[^/]+\/context$/.test(url.pathname)) {
const traceId = decodeURIComponent(
url.pathname.slice("/flow/alerts/".length, -"/context".length)
).trim();
if (!traceId || traceId.length > 512) {
return jsonResponse({ error: "invalid alert trace id" }, 400);
}
const data = await fetchAlertContextByTraceId(clickhouse, traceId);
return jsonResponse(data);
}
if (req.method === "GET" && url.pathname === "/option-prints/by-trace") {
const traceIds = url.searchParams.getAll("trace_id");
const data = await fetchOptionPrintsByTraceIds(clickhouse, traceIds);