diff --git a/docs/platforms/apple/common/integrations/supabase.mdx b/docs/platforms/apple/common/integrations/supabase.mdx new file mode 100644 index 0000000000000..4bcec18881bf7 --- /dev/null +++ b/docs/platforms/apple/common/integrations/supabase.mdx @@ -0,0 +1,11 @@ +--- +title: Supabase +description: "Correlate Sentry traces with Supabase logs on Apple platforms." +sidebar_order: 50 +--- + +The Sentry Apple SDK instruments URLSession and automatically injects `sentry-trace` and `baggage` headers into outgoing requests — including those made by the Supabase Swift SDK. Enabling `enablePropagateTraceparent` also adds the W3C `traceparent` header, which Supabase reads to stamp API Gateway and Edge Function logs with your trace ID. + +Combined with [Supabase Log Drains](/product/drains/supabase/), this lets you navigate from a Sentry span directly to the Supabase server logs it produced — with no changes to your `SupabaseClient` setup. + +See the [Supabase Swift trace propagation documentation](https://supabase.com/docs/guides/monitoring-and-debugging/client-side-tracing) for full setup instructions, including the SwiftPM `OpenTelemetry` trait and `enablePropagateTraceparent` configuration. diff --git a/docs/platforms/dart/common/integrations/supabase.mdx b/docs/platforms/dart/common/integrations/supabase.mdx new file mode 100644 index 0000000000000..15b99cc37b4ea --- /dev/null +++ b/docs/platforms/dart/common/integrations/supabase.mdx @@ -0,0 +1,11 @@ +--- +title: Supabase +description: "Correlate Sentry traces with Supabase logs in Dart and Flutter apps." +sidebar_order: 35 +--- + +The Sentry Flutter/Dart SDK can propagate W3C trace context through Supabase API requests. Enabling `propagateTraceparent` (requires `sentry_flutter` ≥9.7.0) attaches the `traceparent` header to outgoing HTTP requests, which Supabase reads to stamp API Gateway and Edge Function logs with your trace ID. + +Combined with [Supabase Log Drains](/product/drains/supabase/), this lets you navigate from a Sentry span directly to the Supabase server logs it produced. + +See the [Supabase Dart trace propagation documentation](https://supabase.com/docs/guides/monitoring-and-debugging/client-side-tracing) for full setup instructions, including the `TracePropagationOptions` API. diff --git a/docs/platforms/javascript/common/configuration/integrations/supabase.mdx b/docs/platforms/javascript/common/configuration/integrations/supabase.mdx index f33cf94112439..49e4174432270 100644 --- a/docs/platforms/javascript/common/configuration/integrations/supabase.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/supabase.mdx @@ -110,3 +110,13 @@ The integration automatically: ## Supported Versions - `@supabase/supabase-js`: `>=2.0.0` + +## Trace Propagation + +Starting with `@supabase/supabase-js` version `2.106.0`, the Supabase client can propagate W3C trace context (`traceparent`) through Supabase services. Because `Sentry.init()` already registers a W3C-compliant OpenTelemetry provider, add `tracePropagation: true` to your `createClient` call. You'll also need to set `propagateTraceparent: true` in `Sentry.init()` (it defaults to `false`) so Sentry actually emits the `traceparent` header. For browser apps, add your Supabase project URL to `tracePropagationTargets` in `Sentry.init()` as well — Sentry only attaches trace headers to cross-origin requests for listed targets, and Supabase is always cross-origin. If you call Supabase Edge Functions directly from the browser, also add `sentry-trace` to the function's CORS allow-list, or the header will be dropped. + +By default, unsampled requests only send a bare `traceparent` (no `tracestate`/`baggage`), so correlation still works but with less context. Set `respectSamplingDecision: false` on the Supabase client if you want full trace context regardless of sampling. + +The `trace_id` from a Sentry span then flows into Supabase API Gateway and Edge Function logs. Combined with [Supabase Log Drains](/product/drains/supabase/), this lets you navigate from a Sentry span directly to the server-side logs it produced. + +See the [Supabase client-side tracing documentation](https://supabase.com/docs/guides/monitoring-and-debugging/client-side-tracing) for full setup instructions. diff --git a/docs/product/drains/supabase.mdx b/docs/product/drains/supabase.mdx index 07265811be566..4b4b7e2923f6f 100644 --- a/docs/product/drains/supabase.mdx +++ b/docs/product/drains/supabase.mdx @@ -33,3 +33,15 @@ ___DSN___ 2. Create a Sentry log drain in the [Supabase dashboard](https://supabase.com/dashboard/project/_/settings/log-drains). Make sure you provide the DSN you grabbed in the previous step. Then you should get logs in your Sentry project. All fields from the log event are attached as attributes to the Sentry log, which can be used for filtering and grouping in the Sentry UI. + +## Correlating Logs with Sentry Traces + +If you enable [client-side trace propagation](https://supabase.com/docs/guides/monitoring-and-debugging/client-side-tracing) in the Supabase SDK, the `trace_id` in forwarded logs will match the Sentry trace that triggered the request. This lets you navigate from a Sentry span directly to the Supabase server logs it produced. + +Note: this only applies to traces Sentry actually samples. By default, unsampled requests still carry a `traceparent` header but omit `tracestate` and `baggage`, so most drained logs won't have a full matching trace unless you raise your sample rate or set `respectSamplingDecision: false` on the Supabase client. If your traces and logs are sampled at different rates, [cross-event querying](https://sentry.io/changelog/cross-event-querying-is-now-ga/) lets you search for traces that specifically have logs attached, which helps close that gap. If you're calling Supabase Edge Functions directly from the browser, make sure `sentry-trace` is added to the function's CORS allow-list — otherwise the header is silently dropped and the log won't correlate even with propagation enabled. + +Setup instructions by platform: + +- **JavaScript**: [Supabase JavaScript integration](/platforms/javascript/guides/node/configuration/integrations/supabase/#trace-propagation) +- **Swift**: [Supabase Swift integration](/platforms/apple/integrations/supabase/) +- **Flutter/Dart**: [Supabase Dart integration](/platforms/dart/integrations/supabase/)