mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## Problem Warehouse query activity is not available in Observability. ## Solution Add a Warehouse report showing query rate over the last hour, with loading, setup, no-data and request-error states. The report uses live project metrics and appears in navigation for projects with Warehouse access. | After | | --- | | <img width="2548" height="1416" alt="CleanShot 2026-11-17 at 16 55 33@2x" src="https://github.com/user-attachments/assets/4d6796e0-72f1-45d5-b6b7-2cd4a3577496" /> | | <img width="2552" height="1390" alt="CleanShot 2026-11-17 at 16 56 18@2x" src="https://github.com/user-attachments/assets/d96efdfd-4ca9-42fe-ac30-9cb4667c95d7" /> | | <img width="2544" height="1388" alt="CleanShot 2026-11-17 at 16 32 11@2x" src="https://github.com/user-attachments/assets/bc80af8d-0468-4229-98d0-ac2681823059" /> | | <img width="2560" height="1344" alt="CleanShot 2026-11-17 at 16 59 53@2x" src="https://github.com/user-attachments/assets/1ed70348-c2fc-4673-85a7-530d9734886c" /> | Visitor | What they see -- | -- Signed-in customer without Warehouse access | No Warehouse entry in Observability Customer with Warehouse access, not configured | “Warehouse is not set up” empty state and setup button Customer with Warehouse disabled | “Warehouse is disabled” empty state and setup button Customer with active Warehouse | Query rate chart, or the relevant loading/empty/error state ## Review instructions 1. Open the [Studio staging preview](https://studio-staging-git-dnywh-warehouse-metrics-client-supabase.vercel.app) with a staging project that has Warehouse access. 2. Go to **Observability > Warehouse**, or `/project/<ref>/observability/warehouse` ([example](https://studio-staging-git-dnywh-warehouse-metrics-client-supabase.vercel.app/dashboard/project/yirnfrgkxmnqgexikhfc/observability/warehouse)). 3. Check the query-rate chart after running Warehouse queries. A project without measurements shows an explicit last-hour empty state. 4. Open the report on a project where Warehouse is not set up and check the setup link. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
73 lines
2.3 KiB
TypeScript
73 lines
2.3 KiB
TypeScript
import { Loader2Icon } from 'lucide-react'
|
|
import { ReactNode } from 'react'
|
|
import { cn, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from 'ui'
|
|
|
|
import { NoDataPlaceholder } from '@/components/ui/Charts/NoDataPlaceholder'
|
|
|
|
export type OverviewTableColumn<T> = {
|
|
key: keyof T | string
|
|
header: string
|
|
render?: (row: T) => ReactNode
|
|
className?: string
|
|
}
|
|
|
|
export interface OverviewTable<T> {
|
|
columns: OverviewTableColumn<T>[]
|
|
data: T[]
|
|
isLoading?: boolean
|
|
emptyMessage?: string
|
|
}
|
|
|
|
export function OverviewTable<T>({ columns, data, isLoading, emptyMessage }: OverviewTable<T>) {
|
|
const hasData = !isLoading && data.length > 0
|
|
|
|
return (
|
|
<Table className="border-t mt-4">
|
|
{hasData && (
|
|
<TableHeader>
|
|
<TableRow>
|
|
{columns.map((col) => (
|
|
<TableHead key={String(col.key)} className={cn(col.className)}>
|
|
{col.header}
|
|
</TableHead>
|
|
))}
|
|
</TableRow>
|
|
</TableHeader>
|
|
)}
|
|
<TableBody className="text-foreground">
|
|
{isLoading ? (
|
|
<TableRow className="[&>td]:hover:bg-transparent">
|
|
<TableCell colSpan={columns.length} className="text-center text-foreground-light">
|
|
<div className="flex items-center justify-center gap-2 py-4">
|
|
<Loader2Icon className="size-4 animate-spin" />
|
|
</div>
|
|
</TableCell>
|
|
</TableRow>
|
|
) : data.length === 0 ? (
|
|
<TableRow className="[&>td]:hover:bg-transparent">
|
|
<TableCell colSpan={columns.length} className="text-center text-foreground-light">
|
|
<div className="p-2 pt-0">
|
|
<NoDataPlaceholder
|
|
size="normal"
|
|
message={emptyMessage || 'No data available'}
|
|
isFullHeight
|
|
/>
|
|
</div>
|
|
</TableCell>
|
|
</TableRow>
|
|
) : (
|
|
(data as unknown as T[]).map((row, idx) => (
|
|
<TableRow key={idx}>
|
|
{columns.map((col) => (
|
|
<TableCell key={String(col.key)} className={cn(col.className)}>
|
|
{col.render ? col.render(row) : (row as any)[col.key as string]}
|
|
</TableCell>
|
|
))}
|
|
</TableRow>
|
|
))
|
|
)}
|
|
</TableBody>
|
|
</Table>
|
|
)
|
|
}
|