Skip to content

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

add max cpu usage chart (#37532)

Jordi Enricc386daf3a0fc
diff --git a/apps/studio/components/ui/Charts/ComposedChart.tsx b/apps/studio/components/ui/Charts/ComposedChart.tsx
index 78e1e45a09c..5f891992832 100644
--- a/apps/studio/components/ui/Charts/ComposedChart.tsx
+++ b/apps/studio/components/ui/Charts/ComposedChart.tsx
@@ -235,7 +235,10 @@ export default function ComposedChart({
})
: []
- const stackedAttributes = chartData.filter((att) => !att.name.includes('max'))
+ const stackedAttributes = chartData.filter((att) => {
+ const attribute = attributes.find((attr) => attr.attribute === att.name)
+ return !attribute?.isMaxValue
+ })
const isPercentage = format === '%'
const isRamChart =
!chartData?.some((att: any) => att.name.toLowerCase() === 'ram_usage') &&
diff --git a/apps/studio/data/reports/database-charts.ts b/apps/studio/data/reports/database-charts.ts
index d57f7a0c4ee..1f38e714f72 100644
--- a/apps/studio/data/reports/database-charts.ts
+++ b/apps/studio/data/reports/database-charts.ts
@@ -34,7 +34,7 @@ export const getReportAttributes = (org: Organization, project: Project): Report
},
{
id: 'avg_cpu_usage',
- label: 'CPU usage',
+ label: 'Average CPU usage',
syncId: 'database-reports',
format: '%',
valuePrecision: 2,
@@ -56,6 +56,30 @@ export const getReportAttributes = (org: Organization, project: Project): Report
},
],
},
+ {
+ id: 'max_cpu_usage',
+ label: 'Max CPU usage',
+ syncId: 'database-reports',
+ format: '%',
+ valuePrecision: 2,
+ availableIn: ['free', 'pro'],
+ hide: false,
+ showTooltip: false,
+ showLegend: false,
+ showMaxValue: false,
+ showGrid: false,
+ hideChartType: false,
+ defaultChartStyle: 'bar',
+ attributes: [
+ {
+ attribute: 'max_cpu_usage',
+ provider: 'infra-monitoring',
+ label: 'Max CPU usage',
+ format: '%',
+ tooltip: 'Max CPU usage',
+ },
+ ],
+ },
{
id: 'disk-iops',
label: 'Disk Input/Output operations per second (IOPS)',