Home / Function/ fetchPostgrestMetrics() — supabase Function Reference

fetchPostgrestMetrics() — supabase Function Reference

Architecture documentation for the fetchPostgrestMetrics() function in usePostgrestOverviewMetrics.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  6dc5f7b0_e897_c508_aed3_93dd2222b782["fetchPostgrestMetrics()"]
  8eb4ef47_85f5_f303_fab9_d995c4addc86["usePostgrestOverviewMetrics()"]
  8eb4ef47_85f5_f303_fab9_d995c4addc86 -->|calls| 6dc5f7b0_e897_c508_aed3_93dd2222b782
  5c02c7e2_18a6_6171_f224_f01a64e652a6["POSTGREST_METRICS_SQL()"]
  6dc5f7b0_e897_c508_aed3_93dd2222b782 -->|calls| 5c02c7e2_18a6_6171_f224_f01a64e652a6
  style 6dc5f7b0_e897_c508_aed3_93dd2222b782 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/Observability/usePostgrestOverviewMetrics.ts lines 56–79

async function fetchPostgrestMetrics(
  { projectRef, startDate, endDate, interval }: PostgrestMetricsVariables,
  signal?: AbortSignal
) {
  const sql = POSTGREST_METRICS_SQL(interval)

  const { data, error } = await get(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
    params: {
      path: { ref: projectRef },
      query: {
        sql,
        iso_timestamp_start: startDate,
        iso_timestamp_end: endDate,
      },
    },
    signal,
  })

  if (error || data?.error) {
    throw error || data?.error
  }

  return (data?.result || []) as MetricsRow[]
}

Subdomains

Frequently Asked Questions

What does fetchPostgrestMetrics() do?
fetchPostgrestMetrics() is a function in the supabase codebase.
What does fetchPostgrestMetrics() call?
fetchPostgrestMetrics() calls 1 function(s): POSTGREST_METRICS_SQL.
What calls fetchPostgrestMetrics()?
fetchPostgrestMetrics() is called by 1 function(s): usePostgrestOverviewMetrics.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free