Skip to content

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

fix(reports): update disk metrics (#41108)

Jordi Enric434634f59f75
diff --git a/apps/docs/content/guides/telemetry/reports.mdx b/apps/docs/content/guides/telemetry/reports.mdx
index ee26f901827..10261969b63 100644
--- a/apps/docs/content/guides/telemetry/reports.mdx
+++ b/apps/docs/content/guides/telemetry/reports.mdx
@@ -52,7 +52,7 @@ The following charts are available for Free and Pro plans:
### Advanced Telemetry
-The following charts provide a more advanced and detailed view of your database performance and are available only for Teams and Enterprise plans.
+The following charts provide a more advanced and detailed view of your database performance and are available only for Team, Enterprise, and Platform plans.
### Memory usage
@@ -154,35 +154,27 @@ Actions you can take:
| Batch write operations | Reduce write IOPS by grouping database writes |
| [Upgrade compute size](/docs/guides/platform/compute-and-disk) | Increase IOPS limits with larger compute instances |
-### Disk IO Usage
+### Disk throughput
-<Image
- alt="Disk IO Usage chart"
- zoomable
- src={{
- dark: '/docs/img/database/reports/disk-io-chart-dark.png',
- light: '/docs/img/database/reports/disk-io-chart-light.png',
- }}
-/>
+Available on Team and Enterprise plans.
-This chart displays the percentage of your allocated IOPS (Input/Output Operations Per Second) currently being used.
+This chart displays read and write throughput (bytes per second) with a reference line showing your compute size's maximum disk throughput.
How it helps debug issues:
-| Issue | Description |
-| --------------------------- | ----------------------------------------------------------- |
-| IOPS limit monitoring | Identify when approaching your allocated IOPS capacity |
-| Performance correlation | Correlate high IO usage with application performance issues |
-| Operation impact assessment | Monitor how database operations affect disk performance |
+| Issue | Description |
+| ------------------------------------ | ------------------------------------------------------- |
+| Throughput bottleneck identification | Spot when disk bandwidth is saturated |
+| Workload pattern analysis | Differentiate read-heavy vs write-heavy bandwidth usage |
+| Performance correlation | Correlate spikes with query performance changes |
Actions you can take:
-| Action | Description |
-| -------------------------------------------------------------- | -------------------------------------------------- |
-| Optimize disk-intensive queries | Reduce queries that perform excessive reads/writes |
-| Add strategic indexes | Reduce sequential scans with appropriate indexing |
-| [Upgrade compute size](/docs/guides/platform/compute-and-disk) | Increase IOPS limits with larger compute instances |
-| Review database design | Optimize schema and query patterns for efficiency |
+| Action | Description |
+| -------------------------------------------------------------- | ------------------------------------------------------------- |
+| Optimize query patterns | Reduce large sequential reads/writes |
+| Tune caching and batching | Minimize repeated disk access and improve throughput headroom |
+| [Upgrade compute size](/docs/guides/platform/compute-and-disk) | Increase throughput limits for sustained workloads |
### Disk size
diff --git a/apps/studio/components/ui/Charts/ComposedChart.tsx b/apps/studio/components/ui/Charts/ComposedChart.tsx
index 60b70434b89..416e2d8a946 100644
--- a/apps/studio/components/ui/Charts/ComposedChart.tsx
+++ b/apps/studio/components/ui/Charts/ComposedChart.tsx
@@ -223,7 +223,12 @@ export function ComposedChart({
if (shouldFormatBytes) {
const bytesValue = isNetworkChart ? Math.abs(value) : value
- return formatBytes(bytesValue, valuePrecision)
+ const formatted = formatBytes(bytesValue, valuePrecision)
+ return format === 'bytes-per-second' ? `${formatted}/s` : formatted
+ }
+
+ if (valuePrecision === 0 && value > 0 && value < 1) {
+ return '<1'
}
return numberFormatter(value, valuePrecision)
@@ -290,7 +295,9 @@ export function ComposedChart({
att.name.toLowerCase().includes('pg_database_size')
)
const isNetworkChart = chartData?.some((att: any) => att.name.toLowerCase().includes('network_'))
- const shouldFormatBytes = isRamChart || isDiskSpaceChart || isDBSizeChart || isNetworkChart
+ const isBytesFormat = format === 'bytes' || format === 'bytes-per-second'
+ const shouldFormatBytes =
+ isBytesFormat || isRamChart || isDiskSpaceChart || isDBSizeChart || isNetworkChart
//*
// Set the y-axis domain
// to the highest value in the chart data for percentage charts
diff --git a/apps/studio/components/ui/Charts/ComposedChart.utils.tsx b/apps/studio/components/ui/Charts/ComposedChart.utils.tsx
index 21ecbe5580b..dbfdc2ae9fc 100644
--- a/apps/studio/components/ui/Charts/ComposedChart.utils.tsx
+++ b/apps/studio/components/ui/Charts/ComposedChart.utils.tsx
@@ -158,7 +158,9 @@ export const CustomTooltip = ({
payload?.some((p: any) => p.dataKey.toLowerCase().includes('disk_fs_')) ||
payload?.some((p: any) => p.dataKey.toLowerCase().includes('pg_database_size'))
const isNetworkChart = payload?.some((p: any) => p.dataKey.toLowerCase().includes('network_'))
- const shouldFormatBytes = isRamChart || isDBSizeChart || isNetworkChart
+ const isBytesFormat = format === 'bytes' || format === 'bytes-per-second'
+ const shouldFormatBytes = isBytesFormat || isRamChart || isDBSizeChart || isNetworkChart
+ const byteUnitSuffix = format === 'bytes-per-second' ? '/s' : ''
const attributesToIgnore =
attributes?.filter((a) => a.omitFromTotal)?.map((a) => a.attribute) ?? []
@@ -180,6 +182,13 @@ export const CustomTooltip = ({
const getIcon = (color: string, isMax: boolean) =>
isMax ? <MaxConnectionsIcon /> : <CustomIcon color={color} />
+ const formatNumeric = (value: number) => {
+ if (!shouldFormatBytes && valuePrecision === 0 && value > 0 && value < 1) return '<1'
+ return shouldFormatBytes
+ ? formatBytes(isNetworkChart ? Math.abs(value) : value, valuePrecision)
+ : numberFormatter(value, valuePrecision)
+ }
+
const LabelItem = ({ entry }: { entry: any }) => {
const attribute = attributes?.find((a: MultiAttribute) => a?.attribute === entry.name)
const percentage = ((entry.value / maxValue) * 100).toFixed(valuePrecision)
@@ -192,9 +201,7 @@ export const CustomTooltip = ({
{attribute?.label || entry.name}
</span>
<span className="ml-3.5 flex items-end gap-1">
- {shouldFormatBytes
- ? formatBytes(isNetworkChart ? Math.abs(entry.value) : entry.value, valuePrecision)
- : numberFormatter(entry.value, valuePrecision)}
+ {formatNumeric(entry.value) + (!isPercentage && format !== 'ms' ? byteUnitSuffix : '')}
{isPercentage ? '%' : ''}
{format === 'ms' ? 'ms' : ''}
@@ -225,9 +232,8 @@ export const CustomTooltip = ({
<span className="flex-grow text-foreground-lighter">Total</span>
<div className="flex items-end gap-1">
<span className="text-base">
- {shouldFormatBytes
- ? formatBytes(total as number, valuePrecision)
- : numberFormatter(total as number, valuePrecision)}
+ {formatNumeric(total as number) +
+ (!isPercentage && format !== 'ms' ? byteUnitSuffix : '')}
{isPercentage ? '%' : ''}
{format === 'ms' ? 'ms' : ''}
</span>
diff --git a/apps/studio/data/reports/database-charts.ts b/apps/studio/data/reports/database-charts.ts
index 92de60e60e6..8f0b36b9d13 100644
--- a/apps/studio/data/reports/database-charts.ts
+++ b/apps/studio/data/reports/database-charts.ts
@@ -138,14 +138,14 @@ export const getReportAttributesV2: (
availableIn: ['free', 'pro', 'team', 'enterprise', 'platform'],
hide: false,
showTooltip: true,
- valuePrecision: 2,
+ valuePrecision: 0,
showLegend: true,
hideChartType: false,
showGrid: true,
showMaxValue: true,
YAxisProps: {
width: 35,
- tickFormatter: (value: any) => numberFormatter(value, 2),
+ tickFormatter: (value: any) => numberFormatter(value, 0),
},
defaultChartStyle: 'line',
attributes: [
@@ -175,31 +175,48 @@ export const getReportAttributesV2: (
],
},
{
- id: 'disk-io-usage',
- label: 'Disk IO Usage',
- docsUrl: `${DOCS_URL}/guides/telemetry/reports#disk-io-usage`,
+ id: 'disk-throughput',
+ label: 'Disk throughput',
+ docsUrl: `${DOCS_URL}/guides/platform/compute-add-ons#disk-throughput`,
syncId: 'database-reports',
availableIn: ['team', 'enterprise', 'platform'],
hide: false,
showTooltip: true,
- format: '%',
- valuePrecision: 6,
- showLegend: false,
- showMaxValue: false,
+ format: 'bytes-per-second',
+ valuePrecision: 1,
+ showLegend: true,
+ showMaxValue: true,
hideChartType: false,
showGrid: true,
YAxisProps: {
width: 70,
- tickFormatter: (value: any) => `${numberFormatter(value, 6)}%`,
+ tickFormatter: (value: any) => `${formatBytes(value, 1)}/s`,
},
- defaultChartStyle: 'line',
+ defaultChartStyle: 'stackedAreaLine',
attributes: [
{
- attribute: 'disk_io_usage',
+ attribute: 'disk_bytes_read',
provider: 'infra-monitoring',
- label: 'IO Usage',
- tooltip:
- 'The actual number of IO operations per second that the database is currently using',
+ label: 'Read throughput',
+ tooltip: 'Disk read throughput (bytes per second)',
+ },
+ {
+ attribute: 'disk_bytes_written',
+ provider: 'infra-monitoring',
+ label: 'Write throughput',
+ tooltip: 'Disk write throughput (bytes per second)',
+ },
+ {
+ attribute: 'disk_throughput_max',
+ provider: 'reference-line',
+ label: 'Max throughput',
+ value:
+ diskConfig?.attributes?.type === 'gp3' &&
+ typeof diskConfig.attributes.throughput_mbps === 'number'
+ ? diskConfig.attributes.throughput_mbps * 1024 * 1024
+ : undefined,
+ tooltip: 'Maximum disk throughput for your current compute size',
+ isMaxValue: true,
},
],
},