Home / Function/ fetchServiceHealthMetrics() — supabase Function Reference

fetchServiceHealthMetrics() — supabase Function Reference

Architecture documentation for the fetchServiceHealthMetrics() function in useServiceHealthMetrics.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  8e6f0ccf_1893_3653_5e36_aa2ae11a25a1["fetchServiceHealthMetrics()"]
  b8c0b026_622b_c2e0_9ae2_367bde44bbd7["useServiceHealthQuery()"]
  b8c0b026_622b_c2e0_9ae2_367bde44bbd7 -->|calls| 8e6f0ccf_1893_3653_5e36_aa2ae11a25a1
  style 8e6f0ccf_1893_3653_5e36_aa2ae11a25a1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/Observability/useServiceHealthMetrics.ts lines 57–90

const fetchServiceHealthMetrics = async (
  projectRef: string,
  table: LogsTableName,
  startDate: string,
  endDate: string,
  signal?: AbortSignal
): Promise<ChartQueryResult[]> => {
  const sql = genChartQuery(
    table,
    {
      iso_timestamp_start: startDate,
      iso_timestamp_end: endDate,
    },
    {}
  )

  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 ChartQueryResult[]
}

Subdomains

Frequently Asked Questions

What does fetchServiceHealthMetrics() do?
fetchServiceHealthMetrics() is a function in the supabase codebase.
What calls fetchServiceHealthMetrics()?
fetchServiceHealthMetrics() is called by 1 function(s): useServiceHealthQuery.

Analyze Your Own Codebase

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

Try Supermodel Free