POSTGREST_METRICS_SQL() — supabase Function Reference
Architecture documentation for the POSTGREST_METRICS_SQL() function in usePostgrestOverviewMetrics.ts from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD 5c02c7e2_18a6_6171_f224_f01a64e652a6["POSTGREST_METRICS_SQL()"] 6dc5f7b0_e897_c508_aed3_93dd2222b782["fetchPostgrestMetrics()"] 6dc5f7b0_e897_c508_aed3_93dd2222b782 -->|calls| 5c02c7e2_18a6_6171_f224_f01a64e652a6 d2281748_00a6_1157_2ba1_8dbd0555251b["getIntervalTrunc()"] 5c02c7e2_18a6_6171_f224_f01a64e652a6 -->|calls| d2281748_00a6_1157_2ba1_8dbd0555251b style 5c02c7e2_18a6_6171_f224_f01a64e652a6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/studio/components/interfaces/Observability/usePostgrestOverviewMetrics.ts lines 26–47
const POSTGREST_METRICS_SQL = (interval: '1hr' | '1day' | '7day') => {
const truncInterval = getIntervalTrunc(interval)
return `
-- postgrest-overview-metrics
select
cast(timestamp_trunc(t.timestamp, ${truncInterval}) as datetime) as timestamp,
countif(response.status_code < 300) as ok_count,
countif(response.status_code >= 300 and response.status_code < 400) as warning_count,
countif(response.status_code >= 400) as error_count
FROM edge_logs t
cross join unnest(metadata) as m
cross join unnest(m.response) as response
cross join unnest(m.request) as request
WHERE
request.path like '/rest/%'
GROUP BY
timestamp
ORDER BY
timestamp ASC
`
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does POSTGREST_METRICS_SQL() do?
POSTGREST_METRICS_SQL() is a function in the supabase codebase.
What does POSTGREST_METRICS_SQL() call?
POSTGREST_METRICS_SQL() calls 1 function(s): getIntervalTrunc.
What calls POSTGREST_METRICS_SQL()?
POSTGREST_METRICS_SQL() is called by 1 function(s): fetchPostgrestMetrics.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free