The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: compute instance specs on usage page
Kevin Grünebergeb4fe2e27914
diff --git a/studio/components/interfaces/BillingV2/Subscription/AddOns/ComputeInstanceSidePanel.tsx b/studio/components/interfaces/BillingV2/Subscription/AddOns/ComputeInstanceSidePanel.tsxindex 43d224f320d..35a3241b55c 100644--- a/studio/components/interfaces/BillingV2/Subscription/AddOns/ComputeInstanceSidePanel.tsx+++ b/studio/components/interfaces/BillingV2/Subscription/AddOns/ComputeInstanceSidePanel.tsx@@ -98,7 +98,9 @@ const ComputeInstanceSidePanel = () => {ui.setNotification({duration: 8000,category: 'success',- message: `Successfully updated compute instance to ${selectedCompute?.name}. Your project is currently being restarted to update its instance`,+ message: `Successfully updated compute instance to ${+ selectedCompute?.name || 'Micro'+ }. Your project is currently being restarted to update its instance`,})app.onProjectStatusUpdated(projectId, PROJECT_STATUS.RESTORING)onClose()diff --git a/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsx b/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsxindex 90298f7e9fe..1681ee1cdce 100644--- a/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsx+++ b/studio/components/interfaces/BillingV2/Usage/Infrastructure.tsx@@ -6,11 +6,13 @@ import Link from 'next/link'import { Alert, Button, IconBarChart2 } from 'ui'import SectionContent from './SectionContent'import SectionHeader from './SectionHeader'-import { COMPUTE_INSTANCE_SPECS, USAGE_CATEGORIES } from './Usage.constants'+import { USAGE_CATEGORIES } from './Usage.constants'import { getUpgradeUrl } from './Usage.utils'import UsageBarChart from './UsageBarChart'import Panel from 'components/ui/Panel'import { useProjectSubscriptionV2Query } from 'data/subscriptions/project-subscription-v2-query'+import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'+import { getAddons } from '../Subscription/Subscription.utils'export interface InfrastructureProps {projectRef: string@@ -31,11 +33,18 @@ const Infrastructure = ({const upgradeUrl = getUpgradeUrl(projectRef, subscription)const isFreeTier = subscription?.plan?.id === 'free'- const currentComputeInstance = subscription?.addons.find((addon) =>- addon.supabase_prod_id.includes('_instance_')- )- const currentComputeInstanceSpecs =- COMPUTE_INSTANCE_SPECS[currentComputeInstance?.supabase_prod_id ?? 'addon_instance_micro']++ const { data: addons, isLoading } = useProjectAddonsQuery({ projectRef })+ const selectedAddons = addons?.selected_addons ?? []++ const { computeInstance } = getAddons(selectedAddons)+ const currentComputeInstanceSpecs = computeInstance?.variant?.meta ?? {+ baseline_disk_io_mbs: 87,+ max_disk_io_mbs: 2085,+ cpu_cores: 2,+ cpu_dedicated: true,+ memory_gb: 1,+ }// Switch to hourly interval, if the timeframe is <48 hourslet interval: '1d' | '1h' = '1d'@@ -144,18 +153,18 @@ const Infrastructure = ({<div className="space-y-1"><p>Disk IO Bandwidth</p>- {currentComputeInstanceSpecs.maxBandwidth ===- currentComputeInstanceSpecs.baseBandwidth ? (+ {currentComputeInstanceSpecs.baseline_disk_io_mbs ===+ currentComputeInstanceSpecs.max_disk_io_mbs ? (<p className="text-sm text-scale-1000">- Your current compute can has a baseline and maximum disk throughput of- {currentComputeInstanceSpecs.maxBandwidth.toLocaleString()} Mbps.+ Your current compute can has a baseline and maximum disk throughput of{' '}+ {currentComputeInstanceSpecs.max_disk_io_mbs?.toLocaleString()} Mbps.</p>) : (<p className="text-sm text-scale-1000">Your current compute can burst up to{' '}- {currentComputeInstanceSpecs.maxBandwidth.toLocaleString()} Mbps for 30+ {currentComputeInstanceSpecs.max_disk_io_mbs?.toLocaleString()} Mbps for 30minutes a day and reverts to the baseline performance of{' '}- {currentComputeInstanceSpecs.baseBandwidth.toLocaleString()} Mbps.+ {currentComputeInstanceSpecs.baseline_disk_io_mbs?.toLocaleString()} Mbps.</p>)}</div>@@ -163,22 +172,22 @@ const Infrastructure = ({<p className="text-sm mb-2">Overview</p><div className="flex items-center justify-between border-b py-1"><p className="text-xs text-scale-1000">Current compute instance</p>- <p className="text-xs">{currentComputeInstance?.name ?? 'Micro'}</p>+ <p className="text-xs">{computeInstance?.variant?.name ?? 'Micro'}</p></div><div className="flex items-center justify-between border-b py-1"><p className="text-xs text-scale-1000">Maximum IO Bandwidth (burst limit)</p><p className="text-xs">- {currentComputeInstanceSpecs.maxBandwidth.toLocaleString()} Mbps+ {currentComputeInstanceSpecs.max_disk_io_mbs?.toLocaleString()} Mbps</p></div><div className="flex items-center justify-between border-b py-1"><p className="text-xs text-scale-1000">Baseline IO Bandwidth</p><p className="text-xs">- {currentComputeInstanceSpecs.baseBandwidth.toLocaleString()} Mbps+ {currentComputeInstanceSpecs.baseline_disk_io_mbs?.toLocaleString()} Mbps</p></div>- {currentComputeInstanceSpecs.maxBandwidth !==- currentComputeInstanceSpecs.baseBandwidth && (+ {currentComputeInstanceSpecs.max_disk_io_mbs !==+ currentComputeInstanceSpecs?.baseline_disk_io_mbs && (<div className="flex items-center justify-between py-1"><p className="text-xs text-scale-1000">Daily burst time limit</p><p className="text-xs">30 mins</p>@@ -205,9 +214,10 @@ const Infrastructure = ({{attribute.key === 'ram_usage' && (<div className="text-sm text-scale-1000"><p>- Your compute instance has {currentComputeInstanceSpecs.memoryGb} GB of memory.+ Your compute instance has {currentComputeInstanceSpecs.memory_gb} GB of+ memory.</p>- {currentComputeInstanceSpecs.memoryGb === 1 && (+ {currentComputeInstanceSpecs.memory_gb === 1 && (<p>As your project is running on the smallest compute instance, it is notunusual for your project to have a base memory usage of ~50%.@@ -218,7 +228,7 @@ const Infrastructure = ({{attribute.key === 'cpu_usage' && (<p className="text-sm text-scale-1000">- Your compute instance has {currentComputeInstanceSpecs.cpuCores} CPU cores.+ Your compute instance has {currentComputeInstanceSpecs.cpu_cores} CPU cores.</p>)}diff --git a/studio/components/interfaces/BillingV2/Usage/Usage.constants.tsx b/studio/components/interfaces/BillingV2/Usage/Usage.constants.tsxindex 35fad4af14b..c4d2b2c1386 100644--- a/studio/components/interfaces/BillingV2/Usage/Usage.constants.tsx+++ b/studio/components/interfaces/BillingV2/Usage/Usage.constants.tsx@@ -362,69 +362,3 @@ export const USAGE_CATEGORIES: CategoryMeta[] = [],},]--// [Joshen] Ideally live in common package for www as well-export const COMPUTE_INSTANCE_SPECS: {- [key: string]: { maxBandwidth: number; baseBandwidth: number; memoryGb: number; cpuCores: number }-} = {- addon_instance_micro: {- memoryGb: 1,- cpuCores: 2,- maxBandwidth: 2085,- baseBandwidth: 87,- },- addon_instance_small: {- memoryGb: 2,- cpuCores: 2,- maxBandwidth: 2085,- baseBandwidth: 174,- },- addon_instance_medium: {- memoryGb: 4,- cpuCores: 2,- maxBandwidth: 2085,- baseBandwidth: 347,- },- addon_instance_large: {- memoryGb: 8,- cpuCores: 2,- maxBandwidth: 4750,- baseBandwidth: 630,- },- addon_instance_xlarge: {- memoryGb: 16,- cpuCores: 4,- maxBandwidth: 4750,- baseBandwidth: 1188,- },- addon_instance_xxlarge: {- memoryGb: 32,- cpuCores: 8,- maxBandwidth: 4750,- baseBandwidth: 2375,- },- addon_instance_4xlarge: {- memoryGb: 64,- cpuCores: 16,- maxBandwidth: 4750,- baseBandwidth: 4750,- },- addon_instance_8xlarge: {- memoryGb: 128,- cpuCores: 32,- maxBandwidth: 9500,- baseBandwidth: 9500,- },- addon_instance_12xlarge: {- memoryGb: 192,- cpuCores: 48,- maxBandwidth: 14250,- baseBandwidth: 14250,- },- addon_instance_16xlarge: {- memoryGb: 256,- cpuCores: 64,- maxBandwidth: 19000,- baseBandwidth: 19000,- },-}