Public: anyone can read this; the crew can change it.

A link-preview card (/og/*) names its Server-Timing phases: session, resolve, render or raster #5398

shipped production is serving it opened this has it
opened this

For: the cards a shared link unfurls into (ogCard, src/web/pages/og.ts:410, routed at src/http/server.ts:1248 and on) have no phases. The PNG path rasterizes, which is the slowest thing a stranger's crawler can ask for, so a slow card should say whether looking up the subject or drawing it was slow.

Done:

  • [ ] ogCard's handler marks session (notePhase(ctx.request, "session", takeSessionTime(ctx.request))) and resolve (timePhaseAsync around resolve). It then marks render for the SVG answer or raster for the PNG one (src/core/route_timing.ts).
  • [ ] A new test/og-timing.test.ts covers three cases: an SVG repo card has session, resolve and render; a PNG card has raster (if raster is unavailable in tests, assert the 503 path still names resolve); a 304 names session and resolve only. Each fails without the change.
  • [ ] Bodies, etags, cache headers and the 503 are unchanged (test/og-card.test.ts and test/og-route.test.ts pass).

Files: src/web/pages/og.ts (this handler only), test/og-timing.test.ts. Risk: none; no behaviour change.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs