Cloudflare D1 Instrumentation

Learn how to add span instrumentation for Cloudflare D1.

You can use the instrumentD1WithSentry method to instrument Cloudflare D1, Cloudflare's serverless SQL database with Sentry.

Copied
import * as Sentry from "@sentry/cloudflare";

// env.DB is the D1 DB binding configured in your `wrangler.toml`
const db = Sentry.instrumentD1WithSentry(env.DB);
// Now you can use the database as usual
await db.prepare("SELECT * FROM table WHERE id = ?").bind(1).run();
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").