Skip to content

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

feat: add additional connection metrics to report (#36225)

Gjorgji Jankovski354c9b6955dc
diff --git a/apps/studio/data/reports/database-charts.ts b/apps/studio/data/reports/database-charts.ts
index d77ab807af9..82eb6551eee 100644
--- a/apps/studio/data/reports/database-charts.ts
+++ b/apps/studio/data/reports/database-charts.ts
@@ -99,7 +99,10 @@ export const getReportAttributesV2 = (org: Organization, project: Project) => {
showLegend: true,
showMaxValue: false,
showGrid: true,
- YAxisProps: { width: 45, tickFormatter: (value: any) => `${numberFormatter(value, 2)}%` },
+ YAxisProps: {
+ width: 45,
+ tickFormatter: (value: any) => `${numberFormatter(value, 2)}%`,
+ },
hideChartType: false,
defaultChartStyle: 'line',
attributes: [
@@ -163,7 +166,10 @@ export const getReportAttributesV2 = (org: Organization, project: Project) => {
hideChartType: false,
showGrid: true,
showMaxValue: true,
- YAxisProps: { width: 35, tickFormatter: (value: any) => numberFormatter(value, 2) },
+ YAxisProps: {
+ width: 35,
+ tickFormatter: (value: any) => numberFormatter(value, 2),
+ },
defaultChartStyle: 'line',
docsUrl: 'https://supabase.com/docs/guides/platform/compute-and-disk#compute-size',
attributes: [
@@ -204,7 +210,10 @@ export const getReportAttributesV2 = (org: Organization, project: Project) => {
showMaxValue: false,
hideChartType: false,
showGrid: true,
- YAxisProps: { width: 70, tickFormatter: (value: any) => `${numberFormatter(value, 6)}%` },
+ YAxisProps: {
+ width: 70,
+ tickFormatter: (value: any) => `${numberFormatter(value, 6)}%`,
+ },
defaultChartStyle: 'line',
attributes: [
{
@@ -226,7 +235,10 @@ export const getReportAttributesV2 = (org: Organization, project: Project) => {
showLegend: true,
showMaxValue: true,
showGrid: true,
- YAxisProps: { width: 65, tickFormatter: (value: any) => formatBytes(value, 1) },
+ YAxisProps: {
+ width: 65,
+ tickFormatter: (value: any) => formatBytes(value, 1),
+ },
hideChartType: false,
defaultChartStyle: 'line',
docsUrl: 'https://supabase.com/docs/guides/platform/database-size',
@@ -282,7 +294,10 @@ export const getReportAttributesV2 = (org: Organization, project: Project) => {
showLegend: true,
showMaxValue: false,
showGrid: true,
- YAxisProps: { width: 65, tickFormatter: (value: any) => formatBytes(value, 1) },
+ YAxisProps: {
+ width: 65,
+ tickFormatter: (value: any) => formatBytes(value, 1),
+ },
hideChartType: false,
defaultChartStyle: 'line',
hideHighlightedValue: true,
@@ -309,29 +324,55 @@ export const getReportAttributesV2 = (org: Organization, project: Project) => {
{
id: 'client-connections',
label: 'Database client connections',
- syncId: 'database-reports',
valuePrecision: 0,
hide: false,
showTooltip: true,
showLegend: true,
showMaxValue: true,
- showGrid: true,
- YAxisProps: { width: 30 },
hideChartType: false,
defaultChartStyle: 'line',
- docsUrl: 'https://supabase.com/docs/guides/platform/compute-and-disk#limits-and-constraints',
attributes: [
{
- attribute: 'pg_stat_database_num_backends',
+ attribute: 'client_connections_postgres',
provider: 'infra-monitoring',
- label: 'Active connections',
+ label: 'postgres',
+ tooltip: 'Active connections',
},
{
- attribute: 'pg_database_max_connections',
- provider: 'reference-line',
- label: 'Max connections',
- value: getConnectionLimits(computeSize).direct,
- tooltip: 'Max available connections for your current compute size',
+ attribute: 'client_connections_authenticator',
+ provider: 'infra-monitoring',
+ label: 'postgrest',
+ tooltip: 'Active connections',
+ },
+ {
+ attribute: 'client_connections_supabase_auth_admin',
+ provider: 'infra-monitoring',
+ label: 'auth',
+ tooltip: 'Active connections',
+ },
+ {
+ attribute: 'client_connections_supabase_storage_admin',
+ provider: 'infra-monitoring',
+ label: 'storage',
+ tooltip: 'Active connections',
+ },
+ {
+ attribute: 'client_connections_supabase_admin',
+ provider: 'infra-monitoring',
+ label: 'supabase-admin',
+ tooltip: 'Active connections',
+ },
+ {
+ attribute: 'client_connections_other',
+ provider: 'infra-monitoring',
+ label: 'other',
+ tooltip: 'Active connections',
+ },
+ {
+ attribute: 'max_db_connections',
+ provider: 'infra-monitoring',
+ label: 'Maximum connections allowed',
+ tooltip: 'Maximum connections for instance size',
isMaxValue: true,
},
],
diff --git a/packages/api-types/types/api.d.ts b/packages/api-types/types/api.d.ts
index bdc4409dcf4..9cd8b1d107a 100644
--- a/packages/api-types/types/api.d.ts
+++ b/packages/api-types/types/api.d.ts
@@ -32,6 +32,26 @@ export interface paths {
patch: operations['v1-update-a-branch-config']
trace?: never
}
+ '/v1/branches/{branch_id}/diff': {
+ parameters: {
+ query?: never
+ header?: never
+ path?: never
+ cookie?: never
+ }
+ /**
+ * [Beta] Diffs a database branch
+ * @description Diffs the specified database branch
+ */
+ get: operations['v1-diff-a-branch']
+ put?: never
+ post?: never
+ delete?: never
+ options?: never
+ head?: never
+ patch?: never
+ trace?: never
+ }
'/v1/branches/{branch_id}/merge': {
parameters: {
query?: never
@@ -810,7 +830,11 @@ export interface paths {
* @description Only available to selected partner OAuth apps
*/
get: operations['v1-list-migration-history']
- put?: never
+ /**
+ * [Beta] Upsert a database migration without applying
+ * @description Only available to selected partner OAuth apps
+ */
+ put: operations['v1-upsert-a-migration']
/**
* [Beta] Apply a database migration
* @description Only available to selected partner OAuth apps
@@ -1627,7 +1651,13 @@ export interface components {
mfa_web_authn_verify_enabled: boolean | null
password_hibp_enabled: boolean | null
password_min_length: number | null
- password_required_characters: string | null
+ /** @enum {string|null} */
+ password_required_characters:
+ | 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ:0123456789'
+ | 'abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:0123456789'
+ | 'abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:0123456789:!@#$%^&*()_+-=[]{};\'\\\\:"|<>?,./`~'
+ | ''
+ | null
rate_limit_anonymous_users: number | null
rate_limit_email_sent: number | null
rate_limit_otp: number | null
@@ -1640,7 +1670,8 @@ export interface components {
saml_enabled: boolean | null
saml_external_url: string | null
security_captcha_enabled: boolean | null
- security_captcha_provider: string | null
+ /** @enum {string|null} */
+ security_captcha_provider: 'turnstile' | 'hcaptcha' | null
security_captcha_secret: string | null
security_manual_linking_enabled: boolean | null
security_refresh_token_reuse_interval: number | null
@@ -1656,9 +1687,11 @@ export interface components {
sms_messagebird_originator: string | null
sms_otp_exp: number | null
sms_otp_length: number
- sms_provider: string | null
+ /** @enum {string|null} */
+ sms_provider: 'messagebird' | 'textlocal' | 'twilio' | 'twilio_verify' | 'vonage' | null
sms_template: string | null
sms_test_otp: string | null
+ /** Format: date-time */
sms_test_otp_valid_until: string | null
sms_textlocal_api_key: string | null
sms_textlocal_sender: string | null
@@ -2920,6 +2953,12 @@ export interface components {
region: string
walg_enabled: boolean
}
+ V1CreateFunctionBody: {
+ body: string
+ name: string
+ slug: string
+ verify_jwt?: boolean
+ }
V1CreateMigrationBody: {
name?: string
query: string
@@ -2930,6 +2969,7 @@ export interface components {
/** @enum {string} */
desired_instance_size?:
| 'pico'
+ | 'nano'
| 'micro'
| 'small'
| 'medium'
@@ -3212,6 +3252,10 @@ export interface components {
db_schema?: string
max_rows?: number
}
+ V1UpsertMigrationBody: {
+ name?: string
+ query: string
+ }
VanitySubdomainBody: {
vanity_subdomain: string
}
@@ -3320,6 +3364,37 @@ export interface operations {
}
}
}
+ 'v1-diff-a-branch': {
+ parameters: {
+ query?: {
+ included_schemas?: string
+ }
+ header?: never
+ path: {
+ /** @description Branch ID */
+ branch_id: string
+ }
+ cookie?: never
+ }
+ requestBody?: never
+ responses: {
+ 200: {
+ headers: {
+ [name: string]: unknown
+ }
+ content: {
+ 'text/plain': string
+ }
+ }
+ /** @description Failed to diff database branch */
+ 500: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ }
+ }
'v1-merge-a-branch': {
parameters: {
query?: never
@@ -5460,6 +5535,46 @@ export interface operations {
}
}
}
+ 'v1-upsert-a-migration': {
+ parameters: {
+ query?: never
+ header?: {
+ /** @description A unique key to ensure the same migration is tracked only once. */
+ 'Idempotency-Key'?: string
+ }
+ path: {
+ /** @description Project ref */
+ ref: string
+ }
+ cookie?: never
+ }
+ requestBody: {
+ content: {
+ 'application/json': components['schemas']['V1UpsertMigrationBody']
+ }
+ }
+ responses: {
+ 200: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ 403: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ /** @description Failed to upsert database migration */
+ 500: {
+ headers: {
+ [name: string]: unknown
+ }
+ content?: never
+ }
+ }
+ }
'v1-apply-a-migration': {
parameters: {
query?: never
@@ -5663,7 +5778,12 @@ export interface operations {
}
cookie?: never
}
- requestBody?: never
+ requestBody: {
+ content: {
+ 'application/json': components['schemas']['V1CreateFunctionBody']
+ 'application/vnd.denoland.eszip': string
+ }
+ }
responses: {
201: {
headers: {
@@ -5784,7 +5904,7 @@ export interface operations {
requestBody: {
content: {
'application/json': components['schemas']['V1UpdateFunctionBody']
- 'application/vnd.denoland.eszip': components['schemas']['V1UpdateFunctionBody']
+ 'application/vnd.denoland.eszip': string
}
}
responses: {
diff --git a/packages/api-types/types/platform.d.ts b/packages/api-types/types/platform.d.ts
index 7862192de73..4b9aa895269 100644
--- a/packages/api-types/types/platform.d.ts
+++ b/packages/api-types/types/platform.d.ts
@@ -16517,6 +16517,10 @@ export interface operations {
| 'disk_bytes_read'
| 'disk_bytes_written'
| 'pg_database_size'
+ | 'disk_fs_size'
+ | 'disk_fs_avail'
+ | 'disk_fs_used'
+ | 'disk_fs_used_wal'
| 'ram_usage'
| 'ram_usage_total'
| 'ram_usage_available'