Skip to content

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

feat: support platform plan usage insights (#41185)

Kevin Grüneberg4b948672a37e
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingBreakdown.constants.ts b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingBreakdown.constants.ts
index 95b8b36bf29..d198c0763ca 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingBreakdown.constants.ts
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingBreakdown.constants.ts
@@ -150,4 +150,32 @@ export const BILLING_BREAKDOWN_METRICS: Metric[] = [
units: 'absolute',
category: 'Database',
},
+ {
+ key: PricingMetric.LOG_INGESTION,
+ name: 'Log Ingestion',
+ units: 'bytes',
+ category: 'Logs',
+ anchor: 'logIngestion',
+ },
+ {
+ key: PricingMetric.LOG_QUERYING,
+ name: 'Log Query',
+ units: 'bytes',
+ category: 'Logs',
+ anchor: 'logQuery',
+ },
+ {
+ key: PricingMetric.LOG_STORAGE,
+ name: 'Log Storage',
+ units: 'bytes',
+ category: 'Logs',
+ anchor: 'logStorage',
+ },
+ {
+ key: PricingMetric.ACTIVE_COMPUTE_HOURS,
+ name: 'Active Compute Hours',
+ units: 'absolute',
+ category: 'compute',
+ anchor: 'active-compute',
+ },
]
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingMetric.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingMetric.tsx
index a2ad298b2a4..a3f75daa433 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingMetric.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/BillingMetric.tsx
@@ -100,7 +100,10 @@ export const BillingMetric = ({
<span className="text-sm" translate="no">
({formatCurrency(usageMeta.cost)})
</span>
- ) : usageMeta.available_in_plan && !usageMeta.unlimited && relativeToSubscription ? (
+ ) : usageMeta.available_in_plan &&
+ usageMeta.pricing_free_units !== 0 &&
+ !usageMeta.unlimited &&
+ relativeToSubscription ? (
<span className="text-sm">{percentageLabel}</span>
) : null}
</Link>
@@ -112,7 +115,10 @@ export const BillingMetric = ({
<span className="text-sm" translate="no">
({formatCurrency(usageMeta.cost)})
</span>
- ) : usageMeta.available_in_plan && !usageMeta.unlimited && relativeToSubscription ? (
+ ) : usageMeta.available_in_plan &&
+ usageMeta.pricing_free_units !== 0 &&
+ !usageMeta.unlimited &&
+ relativeToSubscription ? (
<span className="text-sm">{percentageLabel}</span>
) : null}
</div>
@@ -120,7 +126,9 @@ export const BillingMetric = ({
{usageMeta.available_in_plan ? (
<div>
- {relativeToSubscription && !usageMeta.unlimited ? (
+ {relativeToSubscription &&
+ !usageMeta.unlimited &&
+ usageMeta.pricing_free_units !== 0 ? (
<svg className="h-8 w-8 -rotate-90 transform">
<circle
cx={15}
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/UpcomingInvoice.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/UpcomingInvoice.tsx
index 9fb8c3845fe..46d8ab146bc 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/UpcomingInvoice.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/BillingBreakdown/UpcomingInvoice.tsx
@@ -59,12 +59,8 @@ const UpcomingInvoice = ({ slug }: UpcomingInvoiceProps) => {
// For non-platform customers, compute is broken down per project and contains a breakdown array
const computeItems =
- upcomingInvoice?.lines?.filter(
- (item) =>
- item.description?.toLowerCase().includes('compute') &&
- item.breakdown &&
- item.breakdown?.length > 0
- ) || []
+ upcomingInvoice?.lines?.filter((item) => item.description?.toLowerCase().includes('compute')) ||
+ []
const computeCreditsItem =
upcomingInvoice?.lines?.find((item) => item.description.startsWith('Compute Credits')) ?? null
@@ -80,12 +76,14 @@ const UpcomingInvoice = ({ slug }: UpcomingInvoiceProps) => {
const replicaComputeItems = computeItems.filter((it) => it.metadata?.is_read_replica)
const otherItems =
- upcomingInvoice?.lines?.filter(
- (item) =>
- // In case we have no per-project breakdown for compute, we treat it as a regular item for display purposes
- (!item.usage_metric?.toString()?.startsWith('COMPUTE_HOURS') || !item.breakdown?.length) &&
- !item.description?.toLowerCase().includes('plan')
- ) || []
+ upcomingInvoice?.lines
+ ?.filter(
+ (item) =>
+ !item.description?.toLowerCase().includes('compute') &&
+ !item.description?.toLowerCase().includes('plan') &&
+ item.amount_before_discount > 0
+ )
+ .sort((a, b) => b.amount_before_discount - a.amount_before_discount) || []
return (
<>
@@ -357,6 +355,10 @@ function ComputeLineItem({
// descending by cost
.sort((a, b) => b.computeCosts - a.computeCosts)
+ const computeItemsSortedByCost = computeItems
+ // descending by cost
+ .sort((a, b) => b.amount - a.amount)
+
const computeCosts = Math.max(
0,
computeItems.reduce((prev, cur) => prev + cur.amount_before_discount, 0)
@@ -395,6 +397,23 @@ function ComputeLineItem({
</TableRow>
))}
+ {/* Fallback to breakdown by instance size if project breakdown not available */}
+ {!computeProjects.length &&
+ computeItemsSortedByCost.map((computeItem) => (
+ <TableRow
+ key={title + computeItem.usage_metric}
+ className="text-foreground-light text-xs"
+ >
+ <TableCell className="!py-2 px-0 pl-6">
+ {computeItem.description} - {computeItem.usage_original} Hours
+ </TableCell>
+
+ <TableCell className="!py-2 px-0 text-right" translate="no">
+ {formatCurrency(computeItem.amount)}
+ </TableCell>
+ </TableRow>
+ ))}
+
{computeCredits && (
<TableRow className="text-foreground-light text-xs">
<TableCell className="!py-2 px-0 pl-6">Compute Credits</TableCell>
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/Subscription.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/Subscription.tsx
index 94cb875b077..6b0f5061a05 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/Subscription.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/Subscription.tsx
@@ -83,16 +83,18 @@ const Subscription = () => {
</div>
<div>
- <ProjectUpdateDisabledTooltip projectUpdateDisabled={projectUpdateDisabled}>
- <Button
- type="default"
- className="pointer-events-auto"
- disabled={!canChangeTier}
- onClick={() => snap.setPanelKey('subscriptionPlan')}
- >
- Change subscription plan
- </Button>
- </ProjectUpdateDisabledTooltip>
+ {canChangeTier && (
+ <ProjectUpdateDisabledTooltip projectUpdateDisabled={projectUpdateDisabled}>
+ <Button
+ type="default"
+ className="pointer-events-auto"
+ disabled={!canChangeTier}
+ onClick={() => snap.setPanelKey('subscriptionPlan')}
+ >
+ Change subscription plan
+ </Button>
+ </ProjectUpdateDisabledTooltip>
+ )}
{!canChangeTier &&
(projectUpdateDisabled ? (
<Alert
diff --git a/apps/studio/components/interfaces/Organization/Usage/ActiveCompute.tsx b/apps/studio/components/interfaces/Organization/Usage/ActiveCompute.tsx
new file mode 100644
index 00000000000..b3c34fea549
--- /dev/null
+++ b/apps/studio/components/interfaces/Organization/Usage/ActiveCompute.tsx
@@ -0,0 +1,104 @@
+import { BarChart2 } from 'lucide-react'
+import { useMemo } from 'react'
+
+import Panel from 'components/ui/Panel'
+import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
+import { DataPoint } from 'data/analytics/constants'
+import { PricingMetric, type OrgDailyUsageResponse } from 'data/analytics/org-daily-stats-query'
+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
+import { DOCS_URL } from 'lib/constants'
+import { SectionContent } from './SectionContent'
+import UsageBarChart from './UsageBarChart'
+import { dailyUsageToDataPoints } from './Usage.utils'
+
+export interface ComputeProps {
+ orgDailyStats: OrgDailyUsageResponse | undefined
+ isLoadingOrgDailyStats: boolean
+}
+
+const ActiveCompute = ({ orgDailyStats, isLoadingOrgDailyStats }: ComputeProps) => {
+ const { billingAll } = useIsFeatureEnabled(['billing:all'])
+
+ const chartData: DataPoint[] = dailyUsageToDataPoints(
+ orgDailyStats,
+ (metric) => metric === PricingMetric.ACTIVE_COMPUTE_HOURS
+ )
+
+ const notAllValuesZero = useMemo(() => {
+ return chartData.some(
+ (dataPoint) =>
+ dataPoint['active_compute_hours'] && Number(dataPoint['active_compute_hours']) > 0
+ )
+ }, [chartData])
+
+ return (
+ <div id="active-compute" className="scroll-my-12">
+ <SectionContent
+ section={{
+ name: 'Active Compute Hours',
+ description:
+ 'Amount of active compute hours your projects on scale-to-zero instances consumed. Projects on scale-to-zero instances automatically scale down after a 15m inactivity period.',
+ links: billingAll
+ ? [
+ {
+ name: 'Learn more',
+ url: `${DOCS_URL}/guides/integrations/supabase-for-platforms#pico-compute-instance`,
+ },
+ ]
+ : [],
+ }}
+ >
+ {isLoadingOrgDailyStats && <GenericSkeletonLoader />}
+
+ {!isLoadingOrgDailyStats && (
+ <>
+ <div className="space-y-1">
+ {chartData.length > 0 && (
+ <div className="flex items-center justify-between">
+ <div className="flex items-center space-x-4">
+ <p className="text-sm">Active Compute Hours usage</p>
+ </div>
+ </div>
+ )}
+
+ <div className="flex items-center justify-between border-b last:border-b-0 py-1 last:py-0">
+ <p className="text-sm text-foreground-light">
+ Active Compute Hours usage in period
+ </p>
+ <p className="text-sm">
+ {chartData.reduce(
+ (prev, cur) => prev + ((cur['active_compute_hours'] as number) ?? 0),
+ 0
+ )}{' '}
+ hours
+ </p>
+ </div>
+ </div>
+
+ {chartData.length > 0 && notAllValuesZero ? (
+ <UsageBarChart
+ name={`Active Compute Hours usage`}
+ unit={'hours'}
+ attributes={[{ key: 'active_compute_hours', color: 'blue' }]}
+ data={chartData}
+ yMin={24}
+ />
+ ) : (
+ <Panel>
+ <Panel.Content>
+ <div className="flex flex-col items-center justify-center">
+ <BarChart2 className="text-foreground-light mb-2" />
+ <p className="text-sm">No data in period</p>
+ <p className="text-sm text-foreground-light">May take up to one hour to show</p>
+ </div>
+ </Panel.Content>
+ </Panel>
+ )}
+ </>
+ )}
+ </SectionContent>
+ </div>
+ )
+}
+
+export default ActiveCompute
diff --git a/apps/studio/components/interfaces/Organization/Usage/OrgLogUsage.tsx b/apps/studio/components/interfaces/Organization/Usage/OrgLogUsage.tsx
new file mode 100644
index 00000000000..48f65c75ead
--- /dev/null
+++ b/apps/studio/components/interfaces/Organization/Usage/OrgLogUsage.tsx
@@ -0,0 +1,64 @@
+import { DataPoint } from 'data/analytics/constants'
+import { PricingMetric, type OrgDailyUsageResponse } from 'data/analytics/org-daily-stats-query'
+import type { OrgSubscription } from 'data/subscriptions/types'
+import UsageSection from './UsageSection/UsageSection'
+import { dailyUsageToDataPoints } from './Usage.utils'
+
+export interface OrgLogUsageProps {
+ orgSlug: string
+ projectRef?: string | null
+ startDate: string | undefined
+ endDate: string | undefined
+ subscription: OrgSubscription | undefined
+ currentBillingCycleSelected: boolean
+ orgDailyStats: OrgDailyUsageResponse | undefined
+ isLoadingOrgDailyStats: boolean
+}
+
+const OrgLogUsage = ({
+ orgSlug,
+ projectRef,
+ subscription,
+ currentBillingCycleSelected,
+ orgDailyStats,
+ isLoadingOrgDailyStats,
+}: OrgLogUsageProps) => {
+ const chartMeta: {
+ [key: string]: { data: DataPoint[]; margin: number; isLoading: boolean }
+ } = {
+ [PricingMetric.LOG_INGESTION]: {
+ data: dailyUsageToDataPoints(
+ orgDailyStats,
+ (metric) => metric === PricingMetric.LOG_INGESTION
+ ),
+ margin: 18,
+ isLoading: isLoadingOrgDailyStats,
+ },
+ [PricingMetric.LOG_QUERYING]: {
+ data: dailyUsageToDataPoints(
+ orgDailyStats,
+ (metric) => metric === PricingMetric.LOG_QUERYING
+ ),
+ margin: 20,
+ isLoading: isLoadingOrgDailyStats,
+ },
+ [PricingMetric.LOG_STORAGE]: {
+ data: dailyUsageToDataPoints(orgDailyStats, (metric) => metric === PricingMetric.LOG_STORAGE),
+ margin: 0,
+ isLoading: isLoadingOrgDailyStats,
+ },
+ }
+
+ return (
+ <UsageSection
+ orgSlug={orgSlug}
+ projectRef={projectRef}
+ categoryKey="logs"
+ chartMeta={chartMeta}
+ subscription={subscription}
+ currentBillingCycleSelected={currentBillingCycleSelected}
+ />
+ )
+}
+
+export default OrgLogUsage
diff --git a/apps/studio/components/interfaces/Organization/Usage/SizeAndCounts.tsx b/apps/studio/components/interfaces/Organization/Usage/SizeAndCounts.tsx
index 0887860f75a..98fee9df80e 100644
--- a/apps/studio/components/interfaces/Organization/Usage/SizeAndCounts.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/SizeAndCounts.tsx
@@ -40,6 +40,14 @@ const SizeAndCounts = ({
(metric) => metric === PricingMetric.STORAGE_SIZE
),
},
+ [PricingMetric.DATABASE_SIZE]: {
+ isLoading: isLoadingOrgDailyStats,
+ margin: 14,
+ data: dailyUsageToDataPoints(
+ orgDailyStats,
+ (metric) => metric === PricingMetric.DATABASE_SIZE
+ ),
+ },
}
return (
diff --git a/apps/studio/components/interfaces/Organization/Usage/TotalUsage.tsx b/apps/studio/components/interfaces/Organization/Usage/TotalUsage.tsx
index d61e75dabc6..8e8c93deb44 100644
--- a/apps/studio/components/interfaces/Organization/Usage/TotalUsage.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/TotalUsage.tsx
@@ -33,6 +33,10 @@ const METRICS_TO_HIDE_WITH_NO_USAGE: PricingMetric[] = [
PricingMetric.DISK_SIZE_GB_HOURS_GP3,
PricingMetric.DISK_SIZE_GB_HOURS_IO2,
PricingMetric.DISK_THROUGHPUT_GP3,
+ PricingMetric.LOG_INGESTION,
+ PricingMetric.LOG_STORAGE,
+ PricingMetric.LOG_QUERYING,
+ PricingMetric.ACTIVE_COMPUTE_HOURS,
]
export const TotalUsage = ({
diff --git a/apps/studio/components/interfaces/Organization/Usage/Usage.constants.tsx b/apps/studio/components/interfaces/Organization/Usage/Usage.constants.tsx
index 7f8471d2c65..9ea41399363 100644
--- a/apps/studio/components/interfaces/Organization/Usage/Usage.constants.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/Usage.constants.tsx
@@ -62,7 +62,7 @@ export interface CategoryAttribute {
additionalInfo?: (usage?: OrgUsageResponse) => JSX.Element | null
}
-export type CategoryMetaKey = 'egress' | 'sizeCount' | 'activity' | 'compute'
+export type CategoryMetaKey = 'egress' | 'sizeCount' | 'activity' | 'compute' | 'logs'
export interface CategoryMeta {
key: CategoryMetaKey
@@ -118,6 +118,116 @@ export const USAGE_CATEGORIES: (subscription?: OrgSubscription) => CategoryMeta[
},
]
+ const databaseAndStorageSizeAttributes: CategoryAttribute[] = []
+ if (subscription?.plan.id === 'free') {
+ databaseAndStorageSizeAttributes.push({
+ anchor: 'dbSize',
+ key: PricingMetric.DATABASE_SIZE,
+ attributes: [{ key: PricingMetric.DATABASE_SIZE.toLowerCase(), color: 'white' }],
+ name: 'Database size',
+ chartPrefix: 'Average',
+ unit: 'bytes',
+ description:
+ 'Database size refers to the actual amount of space used by all your database objects, as reported by Postgres.',
+ links: [
+ {
+ name: 'Documentation',
+ url: `${DOCS_URL}/guides/platform/database-size`,
+ },
+ ],
+ chartDescription: 'The data refreshes every hour.',
+ additionalInfo: (usage?: OrgUsageResponse) => {
+ const usageMeta = usage?.usages.find((x) => x.metric === PricingMetric.DATABASE_SIZE)
+ const usageRatio =
+ typeof usageMeta !== 'number'
+ ? (usageMeta?.usage ?? 0) / (usageMeta?.pricing_free_units ?? 0)
+ : 0
+ const hasLimit = usageMeta && (usageMeta?.pricing_free_units ?? 0) > 0
+
+ const isApproachingLimit = hasLimit && usageRatio >= USAGE_APPROACHING_THRESHOLD
+ const isExceededLimit = hasLimit && usageRatio >= 1
+ const isCapped = usageMeta?.capped
+
+ const onFreePlan = subscription?.plan?.name === 'Free'
+
+ return (
+ <div>
+ {(isApproachingLimit || isExceededLimit) && isCapped && (
+ <Admonition
+ type={isExceededLimit ? 'danger' : 'warning'}
+ title={
+ isExceededLimit ? 'Exceeding database size limit' : 'Nearing database size limit'
+ }
+ >
+ <div className="flex w-full items-center flex-col justify-center space-y-2 md:flex-row md:justify-between">
+ <div>
+ When you reach your database size limit, your project can go into read-only
+ mode.{' '}
+ {onFreePlan
+ ? 'Please upgrade your Plan.'
+ : "Disable your spend cap to scale seamlessly, and pay for over-usage beyond your Plan's quota."}
+ </div>
+ </div>
+ </Admonition>
+ )}
+ </div>
+ )
+ },
+ })
+ } else if (subscription?.plan.id !== 'platform') {
+ databaseAndStorageSizeAttributes.push({
+ anchor: 'diskSize',
+ key: 'diskSize',
+ attributes: [],
+ name: 'Disk size',
+ chartPrefix: 'Average',
+ unit: 'bytes',
+ description:
+ "Each Supabase project comes with a dedicated disk. Each project gets 8 GB of disk for free. Billing is based on the provisioned disk size. Disk automatically scales up when you get close to it's size.\nEach hour your project is using more than 8 GB of GP3 disk, it incurs the overages in GB-Hrs, i.e. a 16 GB disk incurs 8 GB-Hrs every hour. Extra disk size costs $0.125/GB/month ($0.000171/GB-Hr).",
+ links: [
+ {
+ name: 'Documentation',
+ url: `${DOCS_URL}/guides/platform/manage-your-usage/disk-size`,
+ },
+ {
+ name: 'Disk Management',
+ url: `${DOCS_URL}/guides/platform/database-size#disk-management`,
+ },
+ ],
+ chartDescription: '',
+ })
+ } else if (subscription?.plan.id === 'platform') {
+ databaseAndStorageSizeAttributes.push({
+ anchor: 'databaseSize',
+ key: PricingMetric.DATABASE_SIZE,
+ attributes: [{ key: PricingMetric.DATABASE_SIZE.toLowerCase(), color: 'white' }],
+ name: 'Database Size',
+ chartPrefix: 'Cumulative',
+ unit: 'bytes',
+ description:
+ 'Database size refers to the actual amount of space used by all your database objects, as reported by Postgres.\nBilling is prorated down to the hour and will be displayed GB-Hrs.',
+ chartDescription: 'The data refreshes every hour.',
+ })
+ }
+
+ databaseAndStorageSizeAttributes.push({
+ anchor: 'storageSize',
+ key: PricingMetric.STORAGE_SIZE,
+ attributes: [{ key: PricingMetric.STORAGE_SIZE.toLowerCase(), color: 'white' }],
+ name: 'Storage Size',
+ chartPrefix: 'Average',
+ unit: 'bytes',
+ description:
+ 'Sum of all objects in your storage buckets.\nBilling is prorated down to the hour and will be displayed GB-Hrs.',
+ chartDescription: 'The data refreshes every hour.',
+ links: [
+ {
+ name: 'Storage',
+ url: `${DOCS_URL}/guides/storage`,
+ },
+ ],
+ })
+
return [
{
key: 'egress',
@@ -129,105 +239,7 @@ export const USAGE_CATEGORIES: (subscription?: OrgSubscription) => CategoryMeta[
key: 'sizeCount',
name: 'Database & Storage Size',
description: 'Amount of resources your project is consuming',
- attributes: [
- subscription?.plan.id === 'free'
- ? {
- anchor: 'dbSize',
- key: PricingMetric.DATABASE_SIZE,
- attributes: [{ key: PricingMetric.DATABASE_SIZE.toLowerCase(), color: 'white' }],
- name: 'Database size',
- chartPrefix: 'Average',
- unit: 'bytes',
- description:
- 'Database size refers to the actual amount of space used by all your database objects, as reported by Postgres.',
- links: [
- {
- name: 'Documentation',
- url: `${DOCS_URL}/guides/platform/database-size`,
- },
- ],
- chartDescription: 'The data refreshes every hour.',
- additionalInfo: (usage?: OrgUsageResponse) => {
- const usageMeta = usage?.usages.find(
- (x) => x.metric === PricingMetric.DATABASE_SIZE
- )
- const usageRatio =
- typeof usageMeta !== 'number'
- ? (usageMeta?.usage ?? 0) / (usageMeta?.pricing_free_units ?? 0)
- : 0
- const hasLimit = usageMeta && (usageMeta?.pricing_free_units ?? 0) > 0
-
- const isApproachingLimit = hasLimit && usageRatio >= USAGE_APPROACHING_THRESHOLD
- const isExceededLimit = hasLimit && usageRatio >= 1
- const isCapped = usageMeta?.capped
-
- const onFreePlan = subscription?.plan?.name === 'Free'
-
- return (
- <div>
- {(isApproachingLimit || isExceededLimit) && isCapped && (
- <Admonition
- type={isExceededLimit ? 'danger' : 'warning'}
- title={
- isExceededLimit
- ? 'Exceeding database size limit'
- : 'Nearing database size limit'
- }
- >
- <div className="flex w-full items-center flex-col justify-center space-y-2 md:flex-row md:justify-between">
- <div>
- When you reach your database size limit, your project can go into
- read-only mode.{' '}
- {onFreePlan
- ? 'Please upgrade your Plan.'
- : "Disable your spend cap to scale seamlessly, and pay for over-usage beyond your Plan's quota."}
- </div>
- </div>
- </Admonition>
- )}
- </div>
- )
- },
- }
- : {
- anchor: 'diskSize',
- key: 'diskSize',
- attributes: [],
- name: 'Disk size',
- chartPrefix: 'Average',
- unit: 'bytes',
- description:
- "Each Supabase project comes with a dedicated disk. Each project gets 8 GB of disk for free. Billing is based on the provisioned disk size. Disk automatically scales up when you get close to it's size.\nEach hour your project is using more than 8 GB of GP3 disk, it incurs the overages in GB-Hrs, i.e. a 16 GB disk incurs 8 GB-Hrs every hour. Extra disk size costs $0.125/GB/month ($0.000171/GB-Hr).",
- links: [
- {
- name: 'Documentation',
- url: `${DOCS_URL}/guides/platform/manage-your-usage/disk-size`,
- },
- {
- name: 'Disk Management',
- url: `${DOCS_URL}/guides/platform/database-size#disk-management`,
- },
- ],
- chartDescription: '',
- },
- {
- anchor: 'storageSize',
- key: PricingMetric.STORAGE_SIZE,
- attributes: [{ key: PricingMetric.STORAGE_SIZE.toLowerCase(), color: 'white' }],
- name: 'Storage Size',
- chartPrefix: 'Average',
- unit: 'bytes',
- description:
- 'Sum of all objects in your storage buckets.\nBilling is prorated down to the hour and will be displayed GB-Hrs.',
- chartDescription: 'The data refreshes every hour.',
- links: [
- {
- name: 'Storage',
- url: `${DOCS_URL}/guides/storage`,
- },
- ],
- },
- ],
+ attributes: databaseAndStorageSizeAttributes,
},
{
key: 'activity',
@@ -348,5 +360,46 @@ export const USAGE_CATEGORIES: (subscription?: OrgSubscription) => CategoryMeta[
},
],
},
+
+ {
+ key: 'logs',
+ name: 'Logs',
+ description: 'Usage statistics related to your logs',
+ attributes: [
+ {
+ anchor: 'logIngestion',
+ key: PricingMetric.LOG_INGESTION,
+ attributes: [{ key: PricingMetric.LOG_INGESTION.toLowerCase(), color: 'white' }],
+ name: 'Log Ingestion',
+ unit: 'absolute',
+ description:
+ 'Total amount of logs ingested across all projects.\nBilling is based on the total amount of logs ingested in Gigabyte.',
+ chartDescription: 'The data refreshes every hour.',
+ links: [],
+ },
+ {
+ anchor: 'logQuery',
+ key: PricingMetric.LOG_QUERYING,
+ attributes: [{ key: PricingMetric.LOG_QUERYING.toLowerCase(), color: 'white' }],
+ name: 'Log Query',
+ unit: 'absolute',
+ description:
+ 'Total amount of logs queried across all projects.\nBilling is based on the total amount of logs queried in Gigabyte.',
+ chartDescription: 'The data refreshes every hour.',
+ links: [],
+ },
+ {
+ anchor: 'logStorage',
+ key: PricingMetric.LOG_STORAGE,
+ attributes: [{ key: PricingMetric.LOG_STORAGE.toLowerCase(), color: 'white' }],
+ name: 'Log Storage',
+ unit: 'absolute',
+ description:
+ 'Total amount of logs stored on the platform. Log retention depends on your platform agreement.\nBilling is based on the total amount of logs stored and factors in the retention period.',
+ chartDescription: 'The data refreshes every hour.',
+ links: [],
+ },
+ ],
+ },
]
}
diff --git a/apps/studio/components/interfaces/Organization/Usage/Usage.tsx b/apps/studio/components/interfaces/Organization/Usage/Usage.tsx
index e10934f2745..c07c217e612 100644
--- a/apps/studio/components/interfaces/Organization/Usage/Usage.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/Usage.tsx
@@ -30,6 +30,8 @@ import Compute from './Compute'
import Egress from './Egress'
import SizeAndCounts from './SizeAndCounts'
import { TotalUsage } from './TotalUsage'
+import ActiveCompute from './ActiveCompute'
+import OrgLogUsage from './OrgLogUsage'
export const Usage = () => {
const { slug } = useParams()
@@ -292,6 +294,13 @@ export const Usage = () => {
<Compute orgDailyStats={orgDailyStats} isLoadingOrgDailyStats={isLoadingOrgDailyStats} />
)}
+ {subscription?.plan.id === 'platform' && (
+ <ActiveCompute
+ orgDailyStats={orgDailyStats}
+ isLoadingOrgDailyStats={isLoadingOrgDailyStats}
+ />
+ )}
+
<Egress
orgSlug={slug as string}
projectRef={selectedProjectRef}
@@ -324,6 +333,19 @@ export const Usage = () => {
orgDailyStats={orgDailyStats}
isLoadingOrgDailyStats={isLoadingOrgDailyStats}
/>
+
+ {subscription?.plan.id === 'platform' && (
+ <OrgLogUsage
+ orgSlug={slug as string}
+ projectRef={selectedProjectRef}
+ subscription={subscription}
+ startDate={startDate}
+ endDate={endDate}
+ currentBillingCycleSelected={currentBillingCycleSelected}
+ orgDailyStats={orgDailyStats}
+ isLoadingOrgDailyStats={isLoadingOrgDailyStats}
+ />
+ )}
</>
)
}
diff --git a/apps/studio/components/interfaces/Organization/Usage/UsageSection/AttributeUsage.tsx b/apps/studio/components/interfaces/Organization/Usage/UsageSection/AttributeUsage.tsx
index 97b4ac48649..b87e27d6547 100644
--- a/apps/studio/components/interfaces/Organization/Usage/UsageSection/AttributeUsage.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/UsageSection/AttributeUsage.tsx
@@ -159,7 +159,7 @@ const AttributeUsage = ({
)}
<div>
- {usageMeta && (
+ {usageMeta && usageMeta.pricing_free_units !== 0 && (
<div className="flex items-center justify-between border-b py-1">
<p className="text-xs text-foreground-light">
Included in {subscription?.plan?.name} Plan
diff --git a/apps/studio/components/interfaces/Organization/Usage/UsageSection/DatabaseSizeUsage.tsx b/apps/studio/components/interfaces/Organization/Usage/UsageSection/DatabaseSizeUsage.tsx
index 0a9ea0f3f55..c468acdf619 100644
--- a/apps/studio/components/interfaces/Organization/Usage/UsageSection/DatabaseSizeUsage.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/UsageSection/DatabaseSizeUsage.tsx
@@ -64,22 +64,28 @@ const DatabaseSizeUsage = ({
</div>
</div>
- <div className="flex items-center justify-between border-b py-1">
- <p className="text-xs text-foreground-light">
- Included in {subscription?.plan?.name} Plan
- </p>
- <p className="text-xs">0.5 GB per project</p>
- </div>
+ {subscription?.plan.id !== 'platform' && (
+ <>
+ <div className="flex items-center justify-between border-b py-1">
+ <p className="text-xs text-foreground-light">
+ Included in {subscription?.plan?.name} Plan
+ </p>
+ <p className="text-xs">0.5 GB per project</p>
+ </div>
- <div className="flex items-center justify-between">
- <p className="text-xs text-foreground-light">Max database size</p>
- <p className="text-xs">
- {databaseSizeUsage?.usage ? formatBytes(databaseSizeUsage?.usage_original) : '-'}
- </p>
- </div>
+ <div className="flex items-center justify-between">
+ <p className="text-xs text-foreground-light">Max database size</p>
+ <p className="text-xs">
+ {databaseSizeUsage?.usage
+ ? formatBytes(databaseSizeUsage?.usage_original)
+ : '-'}
+ </p>
+ </div>
+ </>
+ )}
</div>
- {currentBillingCycleSelected ? (
+ {currentBillingCycleSelected && subscription?.plan.id !== 'platform' ? (
<div className="space-y-4">
<div className="space-y-1">
<p className="text-sm">Current database size per project</p>
diff --git a/apps/studio/components/interfaces/Organization/Usage/UsageSection/UsageSection.tsx b/apps/studio/components/interfaces/Organization/Usage/UsageSection/UsageSection.tsx
index f41aba76e50..a971fba54a9 100644
--- a/apps/studio/components/interfaces/Organization/Usage/UsageSection/UsageSection.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/UsageSection/UsageSection.tsx
@@ -73,7 +73,7 @@ const UsageSection = ({
currentBillingCycleSelected={currentBillingCycleSelected}
usage={usage}
/>
- ) : attribute.key === PricingMetric.DATABASE_SIZE ? (
+ ) : attribute.key === PricingMetric.DATABASE_SIZE && subscription?.plan.id === 'free' ? (
<DatabaseSizeUsage
key={attribute.name}
slug={orgSlug}