mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 03:45: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>
Writing components
Where to create your components
- For components that declare the general structure and layout of a page:
/components/layouts/xxx
- For components that are tightly coupled to a specific interface:
/components/interfaces/xxx
- For components that are meant to be reusable across multiple pages:
/components/ui/xxx
- Note: We're gradually moving files out of the
to-be-cleanedfolder into the respective folders as we refactor
Component structure
- If a component has constants and utility methods that are tightly coupled to itself, keep them close to the component and enclose them in a folder with an
index.tsxas an entry point - Otherwise it can just be a file on its own
- For example:
-
components/ui - SampleComponentA - SampleComponentA.tsx - SampleComponentA.constants.ts - SampleComponentA.utils.ts - SampleComponentA.types.ts - index.ts - SampleComponentB.tsx
-
Template for building components
// Declare the prop types of your component
interface ComponentAProps {
sampleProp: string
}
// Name your component accordingly
const ComponentA = ({ sampleProp }: ComponentAProps) => {
return <div>ComponentA: {sampleProp}</div>
}
export default ComponentA