hydrate alert evidence from clickhouse
This commit is contained in:
parent
cd0a1dd9e5
commit
c0b5b6dbeb
10 changed files with 701 additions and 62 deletions
|
|
@ -47,6 +47,7 @@ import {
|
|||
ensureOptionPrintsTable,
|
||||
fetchAlertsAfter,
|
||||
fetchAlertsBefore,
|
||||
fetchAlertContextByTraceId,
|
||||
fetchClassifierHitsAfter,
|
||||
fetchClassifierHitsBefore,
|
||||
fetchSmartMoneyEventsAfter,
|
||||
|
|
@ -118,6 +119,7 @@ import {
|
|||
resolveLiveStateConfig,
|
||||
shouldFanoutLiveEvent
|
||||
} from "./live";
|
||||
import { isAlertContextPath, parseAlertContextTraceIdPath } from "./alert-context";
|
||||
import { parseOptionPrintQuery } from "./option-queries";
|
||||
import {
|
||||
buildSyntheticDerivedStatus,
|
||||
|
|
@ -1487,6 +1489,25 @@ const run = async () => {
|
|||
return jsonResponse({ data });
|
||||
}
|
||||
|
||||
if (req.method === "GET" && isAlertContextPath(url.pathname)) {
|
||||
try {
|
||||
const traceId = parseAlertContextTraceIdPath(url.pathname);
|
||||
if (traceId === null) {
|
||||
return jsonResponse({ error: "not found" }, 404);
|
||||
}
|
||||
const data = await fetchAlertContextByTraceId(clickhouse, traceId);
|
||||
return jsonResponse(data);
|
||||
} catch (error) {
|
||||
return jsonResponse(
|
||||
{
|
||||
error: "invalid alert context query",
|
||||
detail: error instanceof Error ? error.message : String(error)
|
||||
},
|
||||
400
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (req.method === "GET" && url.pathname === "/history/options") {
|
||||
try {
|
||||
const { beforeTs, beforeSeq, limit } = parseBeforeParams(url);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue