Files
supabase/apps/studio/components/ui/Charts/NoDataPlaceholder.tsx
Danny WhiteandJoshen Lim 48c90094d9 feat(studio): show Warehouse query activity in Observability (#53495)
## 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>
2026-11-19 14:57:39 +11:00

64 lines
1.7 KiB
TypeScript

import { BarChart2Icon } from 'lucide-react'
import { cn } from 'ui'
import { ChartHeader } from './ChartHeader'
import { useChartSize } from './Charts.utils'
interface NoDataPlaceholderProps {
title?: string
attribute?: string
format?: string | ((value: unknown) => string)
message?: string
description?: string
className?: string
size: Parameters<typeof useChartSize>[0]
isFullHeight?: boolean
titleTooltip?: string
hideTotalPlaceholder?: boolean
docsUrl?: string
}
export const NoDataPlaceholder = ({
attribute,
message = 'No data to show',
description,
format,
className = '',
size,
isFullHeight = false,
titleTooltip,
hideTotalPlaceholder = false,
docsUrl,
}: NoDataPlaceholderProps) => {
const { minHeight } = useChartSize(size)
return (
<div className={cn(isFullHeight && 'h-full')}>
{attribute !== undefined && (
<ChartHeader
title={attribute}
format={format}
highlightedValue={hideTotalPlaceholder ? undefined : 0}
titleTooltip={titleTooltip}
docsUrl={docsUrl}
/>
)}
<div
className={cn(
'border-control flex grow w-full flex-col items-center justify-center space-y-2 border border-dashed text-center',
isFullHeight && 'h-full',
className
)}
// extra 20 px for the x ticks
style={{ minHeight: minHeight + 20 }}
>
<BarChart2Icon size={20} className="text-border-stronger" />
<div className="px-1">
<p className="text-foreground-light text-xs">{message}</p>
{description && <p className="text-foreground-lighter text-xs">{description}</p>}
</div>
</div>
</div>
)
}