mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 19:35:06 +03:00
The /observability reports (except database) query the BigQuery logs.all
analytics endpoint. This starts migrating them to the OTEL ClickHouse
endpoint (logs.all.otel) behind a new otelReports feature flag (default off).
This PR covers the SharedAPIReport charts that power the auth, postgrest, and
realtime reports (total requests, top routes, error counts, top error routes,
response speed, top slow routes, network traffic), plus the shared plumbing:
- Add generateOtelWhereSafe in Reports.constants.ts: the ClickHouse counterpart
of generateRegexpWhereSafe, mapping filter keys to log_attributes[...] lookups
(match() for `matches`, int cast for ordering, string equality otherwise).
- Add safeSqlOtel ClickHouse variants for all 7 SharedAPIReport queries (FROM
logs WHERE source = '...', toStartOfHour, count()/avg, toInt64OrZero/
toFloat64OrZero), reusing shared route projection/grouping fragments.
- Gate useSharedAPIReport on useFlag('otelReports'): pick builder + endpoint via
logsAllEndpointUrl, key queries by otel state. BigQuery stays the default.
- Add the useOtel param to fetchLogs (report.utils) so the edge-functions
follow-up only needs ClickHouse SQL.
- Tests for generateOtelWhereSafe. The generated OTEL SQL for all 7 charts was
validated against the staging OTEL endpoint with real project data.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>