Skip to content

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

feat(studio): cross-link disk IO usage to observability charts (#45376)

Jordi Enric90d383f182b2
diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx
index a5d13e268b9..e1b64676ca0 100644
--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx
+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx
@@ -1,9 +1,10 @@
import { useParams } from 'common'
import dayjs from 'dayjs'
import { capitalize } from 'lodash'
-import { BarChart2, ExternalLink } from 'lucide-react'
+import { BarChart2, ChartLine, ExternalLink } from 'lucide-react'
import Link from 'next/link'
import { Fragment, useMemo, useState } from 'react'
+import { Button } from 'ui'
import { Admonition } from 'ui-patterns/admonition'
import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'
@@ -431,6 +432,19 @@ export const InfrastructureActivity = () => {
</Panel.Content>
</Panel>
)}
+ {attribute.key === 'disk_io_consumption' && !hasDedicatedIOResources && (
+ <Admonition
+ type="default"
+ title="Looking for actual disk activity?"
+ description="The chart above shows your remaining burst budget, not real disk throughput. For detailed read/write IOPS and throughput charts, head to the Database Observability page."
+ >
+ <Button asChild type="default" icon={<ChartLine size={14} />}>
+ <Link href={`/project/${projectRef}/observability/database`}>
+ View detailed IOPS and throughput
+ </Link>
+ </Button>
+ </Admonition>
+ )}
</ScaffoldSectionContent>
</ScaffoldSection>
</ScaffoldContainer>
diff --git a/apps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.constants.ts b/apps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.constants.ts
index 1c7253a74e5..e0c3a935254 100644
--- a/apps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.constants.ts
+++ b/apps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.constants.ts
@@ -13,6 +13,9 @@ interface ResourceWarningMessage {
critical: { title?: string; description?: string }
}
docsUrl?: string
+ // In-app destination for inspecting the metric (e.g. observability charts).
+ // [ref] is replaced with the current project ref at render time.
+ metricsHref?: string
buttonText?: string
aiPrompt?: string
metric: string | null
@@ -75,6 +78,7 @@ export const RESOURCE_WARNING_MESSAGES: ResourceWarningMessages = {
},
},
docsUrl: `${DOCS_URL}/guides/troubleshooting/exhaust-disk-io`,
+ metricsHref: '/project/[ref]/observability/database',
buttonText: 'Upgrade compute',
aiPrompt:
'My database is running out of Disk IO budget. Can you query pg_stat_statements to find the top queries by shared blocks read and written, identify which are causing the most disk I/O, and suggest specific optimizations to reduce disk usage?',
diff --git a/apps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.tsx b/apps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.tsx
index 972fae77940..04afa74bac1 100644
--- a/apps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.tsx
+++ b/apps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.tsx
@@ -1,5 +1,5 @@
import { useParams } from 'common'
-import { AlertTriangle, BookOpen, ChevronDown, Sparkles, Wrench } from 'lucide-react'
+import { AlertTriangle, BookOpen, ChartLine, ChevronDown, Sparkles, Wrench } from 'lucide-react'
import Link from 'next/link'
import { useRouter } from 'next/router'
import { COMPUTE_DISK } from 'shared-data'
@@ -102,6 +102,10 @@ export const ResourceExhaustionWarningBanner = () => {
: RESOURCE_WARNING_MESSAGES[activeWarnings[0] as keyof typeof RESOURCE_WARNING_MESSAGES]
?.docsUrl
+ const singleWarningMessage =
+ activeWarnings.length === 1 ? RESOURCE_WARNING_MESSAGES[activeWarnings[0]] : undefined
+ const metricsHref = singleWarningMessage?.metricsHref?.replace('[ref]', ref ?? 'default')
+
const metric =
activeWarnings.length > 1
? RESOURCE_WARNING_MESSAGES.multiple_resource_warnings.metric
@@ -245,6 +249,14 @@ export const ResourceExhaustionWarningBanner = () => {
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
+ {metricsHref !== undefined && (
+ <DropdownMenuItem asChild>
+ <Link href={metricsHref} className="flex items-center gap-x-2 cursor-pointer">
+ <ChartLine size={14} />
+ View metrics
+ </Link>
+ </DropdownMenuItem>
+ )}
<DropdownMenuItem asChild>
<a
href={learnMoreUrl}