Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat(observability): add Data API service to overview (#46266)

Jordi Enric5b9159dca4f4
diff --git a/apps/studio/components/interfaces/Observability/ObservabilityOverview.tsx b/apps/studio/components/interfaces/Observability/ObservabilityOverview.tsx
index 309f14a3a05..749f04cdf61 100644
--- a/apps/studio/components/interfaces/Observability/ObservabilityOverview.tsx
+++ b/apps/studio/components/interfaces/Observability/ObservabilityOverview.tsx
@@ -15,6 +15,7 @@ import ReportHeader from '@/components/interfaces/Reports/ReportHeader'
import ReportPadding from '@/components/interfaces/Reports/ReportPadding'
import { ChartIntervalDropdown } from '@/components/ui/Logs/ChartIntervalDropdown'
import { CHART_INTERVALS } from '@/components/ui/Logs/logs.utils'
+import { useIsDataApiEnabled } from '@/hooks/misc/useIsDataApiEnabled'
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
@@ -27,6 +28,7 @@ export const ObservabilityOverview = () => {
const queryClient = useQueryClient()
const { projectStorageAll: storageSupported } = useIsFeatureEnabled(['project_storage:all'])
+ const { isEnabled: isDataApiEnabled } = useIsDataApiEnabled({ projectRef })
const DEFAULT_INTERVAL: ChartIntervalKey = '1day'
const [interval, setInterval] = useState<ChartIntervalKey>(DEFAULT_INTERVAL)
@@ -64,6 +66,14 @@ export const ObservabilityOverview = () => {
enabled: true,
hasReport: true,
},
+ {
+ key: 'data_api' as const,
+ name: 'API Gateway',
+ reportUrl: undefined,
+ logsUrl: `/project/${projectRef}/logs/edge-logs`,
+ enabled: isDataApiEnabled,
+ hasReport: false,
+ },
{
key: 'auth' as const,
name: 'Auth',
@@ -98,14 +108,14 @@ export const ObservabilityOverview = () => {
},
{
key: 'postgrest' as const,
- name: 'Data API',
+ name: 'PostgREST',
reportUrl: `/project/${projectRef}/observability/postgrest`,
logsUrl: `/project/${projectRef}/logs/postgrest-logs`,
enabled: true,
hasReport: true,
},
],
- [projectRef, storageSupported]
+ [projectRef, storageSupported, isDataApiEnabled]
)
const enabledServices = serviceBase.filter((s) => s.enabled)
diff --git a/apps/studio/components/interfaces/Observability/ObservabilityOverview.utils.ts b/apps/studio/components/interfaces/Observability/ObservabilityOverview.utils.ts
index 3aaa3c386ba..b54aedf719c 100644
--- a/apps/studio/components/interfaces/Observability/ObservabilityOverview.utils.ts
+++ b/apps/studio/components/interfaces/Observability/ObservabilityOverview.utils.ts
@@ -7,7 +7,14 @@ import {
import type { LogsBarChartDatum } from '../ProjectHome/ProjectUsage.metrics'
import { useServiceHealthMetrics } from './useServiceHealthMetrics'
-export type ServiceKey = 'db' | 'functions' | 'auth' | 'storage' | 'realtime' | 'postgrest'
+export type ServiceKey =
+ | 'db'
+ | 'functions'
+ | 'auth'
+ | 'storage'
+ | 'realtime'
+ | 'data_api'
+ | 'postgrest'
export type HealthStatus = 'healthy' | 'error' | 'unknown'
diff --git a/apps/studio/components/interfaces/Observability/ServiceHealthTable.tsx b/apps/studio/components/interfaces/Observability/ServiceHealthTable.tsx
index 4973ff277b0..cda4729c2b8 100644
--- a/apps/studio/components/interfaces/Observability/ServiceHealthTable.tsx
+++ b/apps/studio/components/interfaces/Observability/ServiceHealthTable.tsx
@@ -37,6 +37,7 @@ const SERVICE_DESCRIPTIONS: Record<ServiceKey, string> = {
functions: 'Serverless Edge Functions execution',
storage: 'Object storage for files and assets',
realtime: 'WebSocket connections and broadcasts',
+ data_api: 'Incoming API requests routed through the edge network',
postgrest: 'Auto-generated REST API for your database',
}
diff --git a/apps/studio/components/interfaces/Observability/useServiceHealthMetrics.ts b/apps/studio/components/interfaces/Observability/useServiceHealthMetrics.ts
index f30a511b49e..1e26eb786ea 100644
--- a/apps/studio/components/interfaces/Observability/useServiceHealthMetrics.ts
+++ b/apps/studio/components/interfaces/Observability/useServiceHealthMetrics.ts
@@ -21,7 +21,14 @@ import { useFillTimeseriesSorted } from '@/hooks/analytics/useFillTimeseriesSort
dayjs.extend(utc)
-export type ServiceKey = 'db' | 'functions' | 'auth' | 'storage' | 'realtime' | 'postgrest'
+export type ServiceKey =
+ | 'db'
+ | 'functions'
+ | 'auth'
+ | 'storage'
+ | 'realtime'
+ | 'data_api'
+ | 'postgrest'
export type ServiceHealthData = {
total: number
@@ -52,6 +59,7 @@ const SERVICE_RESPONSE_KEY: Record<
functions: 'function_edge_logs',
storage: 'storage_logs',
realtime: 'realtime_logs',
+ data_api: 'edge_logs',
postgrest: 'postgrest_logs',
}
@@ -154,11 +162,12 @@ export const useServiceHealthMetrics = (
const functions = useServiceHealthQuery({ ...sharedParams, serviceKey: 'functions' })
const storage = useServiceHealthQuery({ ...sharedParams, serviceKey: 'storage' })
const realtime = useServiceHealthQuery({ ...sharedParams, serviceKey: 'realtime' })
+ const data_api = useServiceHealthQuery({ ...sharedParams, serviceKey: 'data_api' })
const postgrest = useServiceHealthQuery({ ...sharedParams, serviceKey: 'postgrest' })
const services: Record<ServiceKey, ServiceHealthData> = useMemo(
- () => ({ db, auth, functions, storage, realtime, postgrest }),
- [db, auth, functions, storage, realtime, postgrest]
+ () => ({ db, auth, functions, storage, realtime, data_api, postgrest }),
+ [db, auth, functions, storage, realtime, data_api, postgrest]
)
const aggregated = useMemo(() => calculateAggregatedMetrics(Object.values(services)), [services])