Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/app/api/cron/health-check/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { timingSafeEqual } from "node:crypto";
import { NextResponse, type NextRequest } from "next/server";
import { getBenchmarkSlugs } from "@/data/benchmarks";
import { getSpecs } from "@/lib/spec";
import { getSpecs, loadAllBenchmarks } from "@/lib/spec";
import { extractMetricName, Prometheus } from "@/lib/prometheus";

export const runtime = "nodejs";
Expand Down Expand Up @@ -214,12 +214,28 @@ export async function GET(req: NextRequest) {
}
}

// Pre-warm the per-bench unstable_cache + KV snapshot layer. This
// single call is what spares an unlucky cold-start user a draft render
// when Prom is slow: it keeps each bench's runtime-cache entry fresh
// and triggers a writeSnapshot to KV so the snapshot fallback always
// has a recent good value to surface. Failures are caught so a Prom
// hiccup here doesn't 500 the cron and lose the Slack alert.
let prewarmCount = 0;
let prewarmErr: string | undefined;
try {
const benches = await loadAllBenchmarks();
prewarmCount = benches.length;
} catch (err) {
prewarmErr = err instanceof Error ? err.message : String(err);
}

return NextResponse.json({
checked: liveSpecs.length,
transitions: transitions.length,
sent: sent.length,
dryRun: !webhook,
transitionsList: transitions,
prewarm: { count: prewarmCount, err: prewarmErr },
});
}

Expand Down
7 changes: 7 additions & 0 deletions src/components/provider-logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ const NEEDS_LIGHT_CHIP = new Set([
"relay",
"debridge",
"tonapi",
// Dark/single-tone logos that need a white chip to read on the page bg:
"1rpc",
"blocknative",
"lava",
"tenderly",
"jito",
"astralane",
]);

function Chip({
Expand Down
9 changes: 7 additions & 2 deletions src/lib/prometheus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ type PromEnvelope<T> =
| { status: "success"; data: T; warnings?: string[] }
| { status: "error"; errorType: string; error: string };

/** Default timeout for Prometheus queries. keep short, build time is finite. */
const DEFAULT_TIMEOUT_MS = 4_000;
/** Default timeout for Prometheus queries. Bumped 4s → 10s after staging
* logs showed `quantile_over_time(0.99, …[24h])` consistently taking
* 4-8s under load (observed 2026-05-26), which would otherwise abort
* the query and collapse the bench to a draft render. 10s is the safe
* upper bound for our heaviest percentile-over-window queries while
* still bounding the SSR render at a tolerable ceiling. */
const DEFAULT_TIMEOUT_MS = 10_000;

export class Prometheus {
constructor(public readonly baseUrl: string) {
Expand Down
Loading