The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(logs): add realtime, supavisor, and pgbouncer to unified logs (#46786)
Jordi Enric9c572a56fd46
diff --git a/apps/studio/components/interfaces/UnifiedLogs/ServiceFlowPanel.tsx b/apps/studio/components/interfaces/UnifiedLogs/ServiceFlowPanel.tsxindex c4a7723148a..ff6058b87c7 100644--- a/apps/studio/components/interfaces/UnifiedLogs/ServiceFlowPanel.tsx+++ b/apps/studio/components/interfaces/UnifiedLogs/ServiceFlowPanel.tsx@@ -30,6 +30,7 @@ import { QuerySearchParamsType } from './UnifiedLogs.types'import { getRowTimestampMs } from './UnifiedLogs.utils'import { useDataTable } from '@/components/ui/DataTable/providers/DataTableProvider'import {+ SERVICE_FLOW_TYPES,ServiceFlowType,useUnifiedLogInspectionQuery,} from '@/data/logs/unified-log-inspection-query'@@ -63,8 +64,12 @@ export function ServiceFlowPanel({}, [selectedRowKey])const logType = selectedRow?.log_type- const serviceFlowType: ServiceFlowType | undefined =- logType === 'edge function' ? 'edge-function' : (logType as ServiceFlowType)+ const normalizedLogType = logType === 'edge function' ? 'edge-function' : logType+ const serviceFlowType: ServiceFlowType | undefined = SERVICE_FLOW_TYPES.includes(+ normalizedLogType as ServiceFlowType+ )+ ? (normalizedLogType as ServiceFlowType)+ : undefinedconst shouldShowServiceFlow = !!serviceFlowTypeuseEffect(() => {diff --git a/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.constants.tsx b/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.constants.tsxindex 47e7b5c2ab7..8abac9cca6d 100644--- a/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.constants.tsx+++ b/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.constants.tsx@@ -16,7 +16,16 @@ import {export const REGIONS = ['ams', 'fra', 'gru', 'hkg', 'iad', 'syd'] as constexport const METHODS = ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'] as const-export const LOG_TYPES = ['postgres', 'postgrest', 'auth', 'storage', 'edge function'] as const+export const LOG_TYPES = [+ 'postgres',+ 'postgrest',+ 'auth',+ 'storage',+ 'edge function',+ 'realtime',+ 'supavisor',+ 'pgbouncer',+] as constexport const DEFAULT_LOG_TYPES = ['postgres', 'postgrest'] as constconst parseAsSort = createParser({diff --git a/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.queries.ts b/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.queries.tsindex 5d111ac7ec2..01839820d90 100644--- a/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.queries.ts+++ b/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.queries.ts@@ -53,6 +53,9 @@ const LOG_TYPE_PREDICATE: Record<string, SafeLogSqlFragment> = {postgres: safeSql`source = 'postgres_logs'`,'edge function': safeSql`source = 'function_edge_logs'`,auth: safeSql`source = 'auth_logs'`,+ realtime: safeSql`source = 'realtime_logs'`,+ supavisor: safeSql`source = 'supavisor_logs'`,+ pgbouncer: safeSql`source = 'pgbouncer_logs'`,}// Derived `log_type` column for SELECT / GROUP BY / countIf use.@@ -63,6 +66,9 @@ const LOG_TYPE_EXPR: SafeLogSqlFragment = safeSql`CASEWHEN source = 'postgres_logs' THEN 'postgres'WHEN source = 'function_edge_logs' THEN 'edge function'WHEN source = 'auth_logs' THEN 'auth'+ WHEN source = 'realtime_logs' THEN 'realtime'+ WHEN source = 'supavisor_logs' THEN 'supavisor'+ WHEN source = 'pgbouncer_logs' THEN 'pgbouncer'ELSE sourceEND`diff --git a/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.utils.ts b/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.utils.tsindex c526a0cfcdd..bc2c09fea07 100644--- a/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.utils.ts+++ b/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.utils.ts@@ -95,6 +95,9 @@ export function formatServiceTypeForDisplay(serviceType: string): string {postgres: 'Postgres',auth: 'Auth',storage: 'Storage',+ realtime: 'Realtime',+ supavisor: 'Supavisor',+ pgbouncer: 'PgBouncer',}return specialCases[serviceType.toLowerCase()] || serviceTypediff --git a/apps/studio/components/interfaces/UnifiedLogs/components/LogTypeIcon.tsx b/apps/studio/components/interfaces/UnifiedLogs/components/LogTypeIcon.tsxindex 2d85e47a3aa..73134ae74fe 100644--- a/apps/studio/components/interfaces/UnifiedLogs/components/LogTypeIcon.tsx+++ b/apps/studio/components/interfaces/UnifiedLogs/components/LogTypeIcon.tsx@@ -1,5 +1,5 @@-import { Auth, EdgeFunctions, Storage } from 'icons'-import { Box, Code2, Database } from 'lucide-react'+import { Auth, EdgeFunctions, Realtime, Storage } from 'icons'+import { Box, Cable, Code2, Database } from 'lucide-react'import { Tooltip, TooltipContent, TooltipTrigger } from 'ui'import { type LOG_TYPES } from '../UnifiedLogs.constants'@@ -11,38 +11,37 @@ interface LogTypeIconProps {className?: string}+type IconComponent = React.ComponentType<{+ size?: number+ strokeWidth?: number+ className?: string+}>++// [Alaister]: commented out types coming in the future+// edge: Globe,+const ICON_MAP: Partial<Record<(typeof LOG_TYPES)[number], IconComponent>> = {+ postgrest: Code2,+ auth: Auth,+ 'edge function': EdgeFunctions,+ postgres: Database,+ storage: Storage,+ realtime: Realtime,+ supavisor: Cable,+ pgbouncer: Cable,+}+export const LogTypeIcon = ({type,size = 16,strokeWidth = 1.5,className,}: LogTypeIconProps) => {- // [Alaister]: commented out types coming in the future- const iconMap: Record<(typeof LOG_TYPES)[number], () => React.ReactNode> = {- // edge: () => <Globe size={size} strokeWidth={strokeWidth} className={className} />,- postgrest: () => <Code2 size={size} strokeWidth={strokeWidth} className={className} />,- auth: () => <Auth size={size} strokeWidth={strokeWidth} className={className} />,- 'edge function': () => (- <EdgeFunctions size={size} strokeWidth={strokeWidth} className={className} />- ),- postgres: () => <Database size={size} strokeWidth={strokeWidth} className={className} />,- // function_events: () => (- // <EdgeFunctions size={size} strokeWidth={strokeWidth} className={className} />- // ),- // supavisor: () => <Cpu size={size} strokeWidth={strokeWidth} className={className} />,- // postgres_upgrade: () => <Cpu size={size} strokeWidth={strokeWidth} className={className} />,- storage: () => <Storage size={size} strokeWidth={strokeWidth} className={className} />,-- // cron: () => <Clock size={size} strokeWidth={strokeWidth} className={className} />,- }-- const IconComponent =- iconMap[type] || (() => <Box size={size} strokeWidth={strokeWidth} className={className} />)+ const Icon = ICON_MAP[type] ?? Boxreturn (<Tooltip><TooltipTrigger>- <IconComponent />+ <Icon size={size} strokeWidth={strokeWidth} className={className} /></TooltipTrigger><TooltipContent side="left"><div className="text-xs">{type}</div>diff --git a/packages/common/telemetry-constants.ts b/packages/common/telemetry-constants.tsindex a06cd36d605..d000c1e47ee 100644--- a/packages/common/telemetry-constants.ts+++ b/packages/common/telemetry-constants.ts@@ -3154,7 +3154,15 @@ export interface UnifiedLogsRowClickedEvent {* Server values are validated against this set by zod (UnifiedLogs.schema.ts) before* reaching the table; anything else is rejected upstream so the union here is exhaustive.*/- logType: 'postgres' | 'postgrest' | 'auth' | 'storage' | 'edge function'+ logType:+ | 'postgres'+ | 'postgrest'+ | 'auth'+ | 'storage'+ | 'edge function'+ | 'realtime'+ | 'supavisor'+ | 'pgbouncer'}groups: TelemetryGroups}