Repository navigation
feat(client): add opt-in trace context propagation headers - #1564
Merged
Merged
Conversation
Adds TracePropagationOptions to SupabaseClient and Supabase.initialize so apps can propagate W3C trace context (traceparent/tracestate/baggage) onto outgoing Supabase requests for distributed tracing. Disabled by default; context is supplied via a traceContextProvider callback and only sent to Supabase hosts, respecting the upstream sampling decision. SDK-1275
The trace-propagation HTTP wrapper is package-internal plumbing, not public API. Annotate it @internal (via package:meta) so it is excluded from the capability matrix's public symbol surface, leaving only TraceContext, TracePropagationOptions, and TraceContextProvider registered. SDK-1275
Vinzent03
reviewed
Jul 8, 2026
# Conflicts: # packages/supabase/pubspec.yaml
Vinzent03
approved these changes
Jul 9, 2026
With gotrue always receiving baseHttpClient when tracing is disabled, the enabled ternary is redundant: tracedHttpClient already equals baseHttpClient in that case. Assign tracedHttpClient directly and tighten the field type. SDK-1275
grdsdev
reviewed
Jul 9, 2026
The traceContextProvider callback is the idiomatic Dart way to deliver this capability, so it is functionally equivalent to supabase-js rather than a partial gap. SDK-1275
mandarini
approved these changes
Jul 10, 2026
Tr00d
approved these changes
Jul 10, 2026
grdsdev
added a commit
to supabase/supabase
that referenced
this pull request
Aug 4, 2026
## Summary Updates SDK reference docs and the client-side tracing guide based on recent releases across all six Supabase SDKs. ## SDKs analyzed | SDK | Repo | Latest commit | Latest tag | |-----|------|--------------|------------| | js | supabase/supabase-js | `e4e8864` | v3.0.0-next.29 | | dart | supabase/supabase-flutter | `c3e3602` | yet_another_json_isolate-v2.1.1 | | py | supabase/supabase-py | `6570638` | v3.0.0a1 | | swift | supabase/supabase-swift | `ebef170` | v2.51.0 | | kt | supabase-community/supabase-kt | `e23df20` | 3.7.0-beta-1 | | csharp | supabase-community/supabase-csharp | `3fad62f` | v1.1.2 | ## Documentation changes ### `apps/docs/spec/supabase_dart_v2.yml` - **OAuth Server API** ([supabase-flutter#1561](supabase/supabase-flutter#1561)): Added `oauth-server-api` group stub and `listGrants()` / `revokeGrant()` method entries, matching the existing `common-client-libs-sections.json` nav IDs. - **`listBuckets()` options** ([supabase-flutter#1557](supabase/supabase-flutter#1557)): Added example showing `ListBucketsOptions` with `search`, `limit`, `offset`, `sortColumn`, and `sortOrder`. ### `apps/docs/spec/supabase_py_v2.yml` - **`on_postgres_changes` `select` param** ([supabase-py#1524](supabase/supabase-py#1524)): Added `listening-to-selected-columns` example for the new `select=["id", "name"]` parameter. - **Expanded filter operators** ([supabase-py#1524](supabase/supabase-py#1524)): Updated `listening-to-row-level-changes` note to list all supported operators (`eq`, `neq`, `lt`, `lte`, `gt`, `gte`, `in`, `like`, `ilike`, `is`, `match`, `imatch`, `isdistinct`) plus `not.` prefix and comma-AND. ### `apps/docs/spec/supabase_swift_v2.yml` - **OpenTelemetry tracing setup** ([supabase-swift#1101](supabase/supabase-swift#1101)): Added `initialize-client-with-opentelemetry` example under the `initializing` section documenting the `OpenTelemetry` SwiftPM package trait, provider wiring, and known `_invokeWithStreamedResponse` limitation. ### `apps/docs/content/guides/telemetry/client-side-tracing.mdx` - **Merged Swift and Dart tracing docs** into the existing JS guide ([supabase-swift#1101](supabase/supabase-swift#1101), [supabase-flutter#1564](supabase/supabase-flutter#1564)). - **Converted to tabbed layout** (`<Tabs queryGroup="language">`) with JavaScript / Swift / Dart tabs, matching the pattern used across other multi-SDK guides. - Updated title to "Client-side tracing" and nav label accordingly. ## SDKs with no doc-worthy changes - **js**: Bug fixes only (auth session clearing, realtime heartbeat suppression) — no new API surface. - **kt**: PKCE for `resend()` — behavioral enhancement, no new spec entry needed. - **csharp**: Chore/compliance/maintenance only. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added Dart “OAuth Server” API docs for listing OAuth grants and revoking grants (including signed-in context and the `clientId` parameter), with examples. * Extended Dart Storage docs with a new `listBuckets` example using `ListBucketsOptions` for filtering, pagination, and sorting. * Updated Python Realtime docs with generalized PostgREST-style row filter operators and added examples for listening to selected columns. * Reworked the “Client-side tracing” guide across JS, Swift, and Dart, including expanded configuration and troubleshooting (trace propagation and `traceparent` details). * Renamed the telemetry navigation label to “Client-side tracing.” <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Sonnet 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds opt-in W3C trace context propagation across outgoing Supabase requests, matching supabase-js observability support. Disabled by default, so existing clients send no additional headers.
When enabled via a new
TracePropagationOptions, the client injectstraceparent,tracestate, andbaggageheaders onto requests targeting Supabase hosts (*.supabase.co,*.supabase.in, the project host, and loopback addresses). Third-party hosts never receive trace headers. The upstream sampling decision is respected by default.Idiomatic difference from supabase-js: JS auto-extracts the active context from the OpenTelemetry global API. Dart has no ubiquitous ambient trace context, so the context is supplied via a
traceContextProvidercallback (the same pattern the SDK already uses foraccessToken). This wires cleanly into the existingAuthHttpClientso postgrest, storage, functions, and gotrue transports are all covered.Outcome: implemented
Changes
packages/supabase/lib/src/trace_propagation.dart— new publicTraceContext,TracePropagationOptions,TraceContextProvider.packages/supabase/lib/src/trace_http_client.dart— internalTracePropagationClientthat injects trace headers for Supabase targets, respecting sampling.packages/supabase/lib/src/supabase_client.dart— newtracePropagationOptionsparameter wired through the auth/gotrue HTTP clients.packages/supabase_flutter/lib/src/supabase.dart— forwardstracePropagationOptionsthroughSupabase.initialize.packages/supabase/test/trace_propagation_test.dart.Reference
supabase-js
@supabase/tracingpackage (packages/shared/tracing) and its wiring inpackages/core/supabase-js/src/lib/fetch.ts.Compliance matrix
client.observability.trace_propagation→implemented(the traceContextProvider callback is the idiomatic Dart equivalent of supabase-js auto-extracting from the OpenTelemetry global API).SDK-1275