You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The .NET SDK now emits traces and metrics for Auth, Postgrest, Storage, and Functions. Collect them with OpenTelemetry and export to any observability backend.
What's new
The .NET SDK emit traces and metrics through System.Diagnostics. Each client exposes its own ActivitySource and Meter, so you subscribe to them the same way you subscribe to any other .NET instrumentation. The SDK takes no dependency on the OpenTelemetry packages, and the clients stay silent until something subscribes, so there is no overhead when you are not collecting.
This covers the Auth, Postgrest, Storage, and Functions clients. Realtime is not yet instrumented. URLs are recorded with the query string stripped, and no token, credential, or payload is placed in a tag.
What you get
Client
Spans
Metrics
Postgrest
One per request ({METHOD} {path}), with a db.operation tag (select, insert, update, upsert, delete, count, rpc) to tell apart operations that share an HTTP verb
supabase.postgrest.http.request.duration
Auth
One per operation (gotrue.sign_in, gotrue.refresh_token, …), with a child span for the HTTP call
supabase.gotrue.http.request.duration
Storage
One per request, with a storage.transfer.direction tag on uploads and downloads; a resumable (TUS) upload is a single span for the whole transfer
Then register the Supabase sources. Each client shares one name between its ActivitySource and its Meter, so you can register them all at once with SupabaseDiagnostics.SourceNames, or one client at a time by its own SourceName:
usingOpenTelemetry.Metrics;usingOpenTelemetry.Trace;usingSupabase;usingSupabase.Postgrest;usingSupabase.Gotrue;usingSupabase.Storage;usingSupabase.Functions;builder.Services.AddOpenTelemetry()// All sources at once..WithTracing(tracing =>tracing.AddSource(SupabaseDiagnostics.SourceNames.ToArray()).AddOtlpExporter())// Or one client at a time..WithMetrics(metrics =>metrics.AddMeter(PostgrestDiagnostics.SourceName).AddMeter(GotrueDiagnostics.SourceName).AddMeter(StorageDiagnostics.SourceName).AddMeter(FunctionsDiagnostics.SourceName).AddOtlpExporter());
Swap AddOtlpExporter for AddConsoleExporter to print locally, or use any other exporter. Without the OpenTelemetry SDK, a raw ActivityListener or MeterListener works too. We have one README per-package which shows how to do it.
Why it matters
You get the SDK's calls in the same traces as the rest of your app: which ran, how long they took, whether they failed. You write no instrumentation for it, and the SDK pulls in no OpenTelemetry dependency of its own.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
The .NET SDK now emits traces and metrics for Auth, Postgrest, Storage, and Functions. Collect them with OpenTelemetry and export to any observability backend.
What's new
The .NET SDK emit traces and metrics through
System.Diagnostics. Each client exposes its ownActivitySourceandMeter, so you subscribe to them the same way you subscribe to any other .NET instrumentation. The SDK takes no dependency on the OpenTelemetry packages, and the clients stay silent until something subscribes, so there is no overhead when you are not collecting.This covers the Auth, Postgrest, Storage, and Functions clients. Realtime is not yet instrumented. URLs are recorded with the query string stripped, and no token, credential, or payload is placed in a tag.
What you get
{METHOD} {path}), with adb.operationtag (select,insert,update,upsert,delete,count,rpc) to tell apart operations that share an HTTP verbsupabase.postgrest.http.request.durationgotrue.sign_in,gotrue.refresh_token, …), with a child span for the HTTP callsupabase.gotrue.http.request.durationstorage.transfer.directiontag on uploads and downloads; a resumable (TUS) upload is a single span for the whole transfersupabase.storage.http.request.duration,supabase.storage.transfer.duration,supabase.storage.transfer.sizefaas.invoked_nametag; a relay error is a failed span even when the HTTP status succeedssupabase.functions.invoke.durationHow to use it
Add the OpenTelemetry hosting package and an exporter alongside the SDK:
Then register the Supabase sources. Each client shares one name between its
ActivitySourceand itsMeter, so you can register them all at once withSupabaseDiagnostics.SourceNames, or one client at a time by its ownSourceName:Swap
AddOtlpExporterforAddConsoleExporterto print locally, or use any other exporter. Without the OpenTelemetry SDK, a rawActivityListenerorMeterListenerworks too. We have one README per-package which shows how to do it.Why it matters
You get the SDK's calls in the same traces as the rest of your app: which ran, how long they took, whether they failed. You write no instrumentation for it, and the SDK pulls in no OpenTelemetry dependency of its own.
Affected products: supabase-dotnet
Authored by @Tr00d
All reactions