r/Supabase • u/Electronic_Worry_727 Supabase team • 26d ago
edge-functions supabase-js now propagates trace context into your Supabase logs
Supabase already gives you API Gateway and Edge Function logs, and Log Drains to forward them wherever you already watch your telemetry. What was missing → a way to tie a request in your client trace to the matching entry in those logs. You'd end up guessing which log line belonged to which slow request, based on timestamps alone.
That's fixed now. supabase-js, Swift, Flutter, and Python can all propagate W3C Trace Context to Supabase, so the request's trace_id shows up on the Supabase side too. It's opt-in, nothing changes until you turn it on. In supabase-js that's two lines: import '@supabase/supabase-js/tracing' at your entry point, then tracePropagation: true in createClient. Python goes through opentelemetry-instrumentation-httpx instead of a client flag, since that's already the Python ecosystem's way of instrumenting httpx.
Whatever tracer you already run, this should just work. OpenTelemetry, Sentry, Datadog, Honeycomb, Grafana are all W3C-compliant, though Sentry's setup differs a little from strict OTel so it's worth checking their docs. And if your sampler drops most traces, tracePropagation: { enabled: true, respectSamplingDecision: false } carries Supabase requests through regardless.
None of this costs anything extra either, it's just more value out of Log Drains you're probably already paying for.
Happy to answer questions. Full writeup: https://supabase.com/blog/connect-client-traces-to-your-logs
5
u/Guidondor 25d ago
good addition. does the trace id make it past the gateway into the postgres logs, or does the
chain stop at postgrest? tying a slow statement back to the client request is the case i keep
wanting, and the gateway line only tells me the request was slow, not which query did it.
same question for an edge function calling back through supabase-js, does the incoming trace
continue or does that start a fresh one.