hydrate alert evidence from clickhouse

This commit is contained in:
dirtydishes 2026-05-17 11:02:30 -04:00
parent cd0a1dd9e5
commit c0b5b6dbeb
10 changed files with 701 additions and 62 deletions

View file

@ -0,0 +1,21 @@
import { z } from "zod";
export const alertContextTraceIdSchema = z
.string()
.trim()
.min(1)
.max(256)
.regex(/^[A-Za-z0-9][A-Za-z0-9:_./-]*$/);
export const isAlertContextPath = (pathname: string): boolean => {
return /^\/flow\/alerts\/[^/]+\/context$/.test(pathname);
};
export const parseAlertContextTraceIdPath = (pathname: string): string | null => {
if (!isAlertContextPath(pathname)) {
return null;
}
const encodedTraceId = pathname.slice("/flow/alerts/".length, -"/context".length);
return alertContextTraceIdSchema.parse(decodeURIComponent(encodedTraceId));
};