Skip to content

Add Sentry performance instrumentation#48

Open
sergical wants to merge 4 commits intomainfrom
feat/sentry-performance-instrumentation
Open

Add Sentry performance instrumentation#48
sergical wants to merge 4 commits intomainfrom
feat/sentry-performance-instrumentation

Conversation

@sergical
Copy link
Collaborator

Summary

  • Add @sentry/cloudflare and wrap D1 binding with instrumentD1WithSentry() so every Drizzle query creates SDK-compatible child spans
  • Wrap critical server operations with named Sentry.startSpan() calls: predictions (fetch/save), scoring (recalculate + per-user upsert), auth middleware, leaderboard, activity feed, bracket views, and OG image generation
  • No behavior changes — purely observability additions

Named spans added

Span File
predictions.fetch / predictions.save src/routes/api/predictions/index.ts
scoring.recalculateAll / scoring.upsertUser src/lib/scoring.ts
auth.requireAuth src/lib/middleware/auth.ts
auth.requireAdmin src/lib/middleware/admin.ts
leaderboard.fetch src/components/leaderboard/Leaderboard.tsx
activity.getRecentPickers src/components/leaderboard/Activity.tsx
bracket.getPublic src/routes/api/bracket/$username.ts
bracket.getData src/routes/bracket/$username.tsx
og.generateImage src/routes/api/og.$username.ts

Test plan

  • Deploy to preview URL via Cloudflare
  • Navigate the site and verify named spans appear in Sentry Performance
  • Log in and submit bracket picks → verify predictions.save span with DB children
  • Visit a shared bracket page → verify bracket.getData and bracket.getPublic spans
  • Run score recalculation from admin → verify scoring.recalculateAll with per-user child spans
  • pnpm build passes (verified locally)
  • pnpm test passes — 17/17 (verified locally)

🤖 Generated with Claude Code

Instrument D1 queries via @sentry/cloudflare and wrap critical server
operations with named Sentry spans: predictions, scoring, auth, leaderboard,
activity feed, bracket views, and OG image generation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 17, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
mad-css d56f047 Commit Preview URL

Branch Preview URL
Feb 17 2026, 06:46 PM

sergical and others added 3 commits February 17, 2026 11:05
… and formatting fixes

Enable client-side tracing via tanstackRouterBrowserTracingIntegration, set
tracesSampleRate (1.0 dev / 0.2 prod) on both client and server, add Sentry
diagnostics panel in admin, and clean up debug console.error calls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use logs and metrics instead of captureMessage per Sentry best practices.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments