Files
supabase/apps/studio/data/database/keys.ts
Bobbie Soedirgo 105df5291d feat: initial supamonitor changes (#42313)
Add a Query Performance page implementation powered by
[supamonitor](https://github.com/supabase/supamonitor).
[Context](https://linear.app/supabase/project/build-extension-for-supabase-query-insights-df4fb145352c/overview)

This looks largely the same as the pg_stat_monitor implementation:

<img width="2556" height="960" alt="Screenshot 2026-02-12 at 7 35 47 PM"
src="https://github.com/user-attachments/assets/bf37466e-f7af-41f2-b4f2-cf8eb6a8c76f"
/>

Only available on projects on custom AMI - existing users are unaffected

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Supamonitor-based query performance view: charts, aggregated metrics,
date-range controls, and export/download.
  * Added "Application" column for per-application tracking.
* Interactive Supamonitor grid: sorting, filtering, keyboard navigation,
selection, retry/error handling.
* Automatic per-project Supamonitor detection with toggleable UI
integration.

* **Bug Fixes**
* Chart latency calculation prefers histogram data for more accurate
p95.

* **Documentation**
  * Minor blog formatting fix.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: kemal <hello@kemal.earth>
Co-authored-by: Ali Waseem <waseema393@gmail.com>
2026-02-17 15:11:46 +08:00

52 lines
2.9 KiB
TypeScript

export const databaseKeys = {
schemas: (projectRef: string | undefined) => ['projects', projectRef, 'schemas'] as const,
keywords: (projectRef: string | undefined) => ['projects', projectRef, 'keywords'] as const,
migrations: (projectRef: string | undefined) => ['projects', projectRef, 'migrations'] as const,
tableColumns: (
projectRef: string | undefined,
schema: string | undefined,
table: string | undefined
) => ['projects', projectRef, 'table-columns', schema, table] as const,
databaseFunctions: (projectRef: string | undefined) =>
['projects', projectRef, 'database-functions'] as const,
entityDefinition: (projectRef: string | undefined, id?: number) =>
['projects', projectRef, 'entity-definition', id] as const,
entityDefinitions: (projectRef: string | undefined, schemas: string[]) =>
['projects', projectRef, 'entity-definitions', schemas] as const,
tableDefinition: (projectRef: string | undefined, id?: number) =>
['projects', projectRef, 'table-definition', id] as const,
viewDefinition: (projectRef: string | undefined, id?: number) =>
['projects', projectRef, 'view-definition', id] as const,
backups: (projectRef: string | undefined) =>
['projects', projectRef, 'database', 'backups'] as const,
poolingConfiguration: (projectRef: string | undefined) =>
['projects', projectRef, 'database', 'pooling-configuration'] as const,
indexesFromQuery: (projectRef: string | undefined, query: string) =>
['projects', projectRef, 'indexes', { query }] as const,
indexAdvisorFromQuery: (projectRef: string | undefined, query: string) =>
['projects', projectRef, 'index-advisor', { query }] as const,
tableConstraints: (projectRef: string | undefined, id?: number) =>
['projects', projectRef, 'table-constraints', id] as const,
foreignKeyConstraints: (projectRef: string | undefined, schema?: string) =>
['projects', projectRef, 'foreign-key-constraints', schema] as const,
databaseSize: (projectRef: string | undefined) =>
['projects', projectRef, 'database-size'] as const,
maxConnections: (projectRef: string | undefined) =>
['projects', projectRef, 'max-connections'] as const,
pgbouncerStatus: (projectRef: string | undefined) =>
['projects', projectRef, 'pgbouncer', 'status'] as const,
pgbouncerConfig: (projectRef: string | undefined) =>
['projects', projectRef, 'pgbouncer', 'config'] as const,
checkPrimaryKeysExists: (
projectRef: string | undefined,
tables: { name: string; schema: string }[]
) => ['projects', projectRef, 'check-primary-keys', tables] as const,
tableIndexAdvisor: (
projectRef: string | undefined,
schema: string | undefined,
table: string | undefined
) => ['projects', projectRef, 'table-index-advisor', schema, table] as const,
supamonitorEnabled: (projectRef: string | undefined) =>
['projects', projectRef, 'supamonitor-enabled'] as const,
}