Commit Graph

41 Commits

Author SHA1 Message Date
Ivan Vasilov 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00
Ivan Vasilov 308cd791a2 chore: Prep work for migrating to Tailwind v4 (#45285)
This PR preps the monorepo for a migration to Tailwind v4:
- Bump all Tailwind dependencies and libraries to the latest possible
version, while still compatible with Tailwind 3.
- Cleans up obsolete Tailwind 3 specific options and configs.
- Cleans up unused CSS files and fixes the CSS imports.
- Migrates all `important` uses in `@apply` lines to using the `!`
prefix.
- Move `typography.css` to the `config` package and import it from the
apps.
- Migrated all occurrences of `flex-grow`, `flex-shrink`,
`overflow-clip` and `overflow-ellipsis` since they're deprecated and
will be removed in Tailwind 4.
- Make the default theme object typesafe in the `ui` package.
- Migrate all `bg-opacity`, `border-opacity`, `ring-opacity` and
`divider-opacity` to the new format where they're declared as part of
the property color.
- Bump and unify all imports of `postcss` dependency.
2026-04-28 11:33:53 +02:00
Charis 4a0bb36ca8 style: require sorted imports in studio/components (#44408)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-04-01 10:22:37 +02:00
Ivan Vasilov ee8eae7309 chore: Clean the ui package from next imports (#44278)
This PR moves several components which rely on `next` out of the `ui`
package to the `ui-patterns` package.

`ui-patterns` package is intented to be imported with specific imports
so it's ok if there are components reliant on `next` in there.

The `SonnerToaster` component has removed its dependency by requiring a
prop for `theme`.
2026-03-30 10:58:37 +02:00
Jordi Enric 2e1795dfa0 feat(studio): add pagination to query performance page FE-2774 (#43697)
## Problem

The Query Performance page loaded all results in a single query with a
fixed limit of 20 rows, giving users no way to browse beyond the first
page. There was also no way to control how many rows were shown at once.

## Fix

adds pagination 

## How to test

- Navigate to `/observability/query-performance` in Studio
- scroll to bottom
- should automatically load more results

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 15:27:43 +01:00
Ivan Vasilov 9fa96977be chore: Minor prettier fixes (#43849)
This PR fixes some prettier issues:
- Bump and unify all prettier versions to 3.7.3 across teh whole repo
- Bump the SQL prettier plugin
- When running `test:prettier`, check `mdx` files also
- Run the new prettier format on all files

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-03-17 11:17:42 +01:00
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
Ali Waseem ec20b7e326 feature: add explain with AI in query performance (#41415)
* feature: add explain with AI in query performance

* updated comment

* updated to send message right away

* updated prompt

* added event tracking for button

* updated prompt

* updated to use track

* updated event name

* added flag for explain with AI

* updated to remove optional
2025-12-18 19:19:25 +00:00
kemal.earth 1e84d28c81 feat(studio): filter out internal schemas from index advisor (#41428)
* feat: prototype of filtering out internal schemas from index advisor

* chore: coderabbit suggestion

* chore: use zod for ia schema
2025-12-18 13:24:18 +00:00
Jordi Enric 9685711519 chore(query-perf): better error handling and sentry tracking (#41278)
* add retry

* handle and capture errors

* adds tests

* improve Sentry integration

* remove SQL logging from query performance error capture

* fix error msg prop handling

* add max and baseline to alert

* undo change meant for other branch oops
2025-12-15 20:39:09 +01:00
kemal.earth b9908aec55 fix(studio): scope indexes tab to just select queries (#41116)
feat: scope indexes tab to just select queries
2025-12-05 17:22:25 +00:00
kemal.earth 511b6faada feat(studio): surface index advisor indicators (#40788)
* feat: change the check to show index advisor tab at all times

* fix: hide add to log drains on export menu in query perf

* fix: small fallback for pathname check

* fix: query perf header block responsiveness

* feat: admonition for index advisor

* fix: add aria-describedby to query perf sheet

* feat: proper way to do sheet description

* chore: better title spacing in panel

* fix: indexes in use empty state

* fix: key in observability menu

* feat: better highlighting of index advisor issues

* feat: add docs button to empty indexes tab

* feat: remove unused code

* feat: use button tooltips for reset and refresh to gain space

* feat: add dismiss to index advisor banner

* feat: add warnings filter to query perf

* feat: filter all queries for warnings

* fix: selected state for warning rows

* fix: fallback for isLogs check

* fix: other instance of download button

---------

Co-authored-by: Ali Waseem <waseema393@gmail.com>
2025-11-27 08:20:07 -07:00
kemal.earth dafc04a9d2 feat(studio): add comparisons to query perf calls filter (#40518)
feat: add numeric filter for query perf calls
2025-11-17 08:33:23 -07:00
Jordi Enric d822de064c feat: add min calls filter to Query Performance FE-2071 (#40125)
* update filter bar ui

* add minCalls to params

* fix type error
2025-11-04 14:24:54 +01:00
kemal.earth ec53ba827b fix(studio): cache hit rate on query perf with pg_stat_statements (#39804)
fix: cache hit rate on query perf with pg_stat_statements

On the old table the number wasnt rendering due to it being a string. Added a guard.
2025-10-23 13:12:36 +01:00
Ivan Vasilov 56d40fe0b2 chore: Migrate eslint for all apps to use flat config (#39486)
* Use the "eslint" command instead of built-in next lint since it's getting obsolete.

* Bump all deps to support eslint 9+.

* Convert the rules in eslint-config-supabase to be flat-config compatible.

* Migrate all apps to use the new eslint config rules.

* Fix all errors found in the new setup.

* Fix the no default exports ignores.

* Scan all files for linting in studio.

* Fix all lint errors.

* Make the reportUnusedDisableDirectives a warning.
2025-10-15 16:35:24 +02:00
kemal.earth 70a64f8c00 feat(studio): query performance metrics chart (#39431)
* feat: setup chart area and tabs

This sets up the area where we can expect the insights chart as well as the tabs mechanism.

* feat: parse pg_stat_monitor logs as json

* feat: create query perf chart utils and move transfrom function

Created a utils file for our QueryPerformanceChart component. This moves the logs to JSON transform function there.

* feat: add timerange to chart

* feat: add date selector to query perf overview

This adds the selector to the top right of the page allowing the user to switch between last hour, 3 hours and 24 hours

* feat: modify chart component to accomodate hiding bits

* feat: add metrics to each tab

* chore: update to 60 min by default and some css

* feat: centralise data parsing for logs

* feat: clean up filters bar

This rewires the export to give you the aggregate pg_stat_monitor data. Also removes unused buttons and filters.

* feat: percentiles for query latency chart

* feat: filter out non evenets from pg_stat_monitor logs

* feat: utils for cache misses and hits

* feat: add selected query to chart on click

* feat: add click through to query panel

* chore: tidy up files

* chore: distinction between selected and open panel

* feat: move query performance fully into reports area

* fix: preserve query params on reports link

* fix: remove right icon syntax in report menu

* chore: remove cache misses from cache chart

* refactor: backwards compatibility for statements if right db version isnt available

* chore: delete randomly generated empty file

* chore: tidy up unused imports and vars

* chore: remove console logs

* chore: remove isMounted from query perf

* fix: cmd k query perf path

* feat: simplify query latency only p50 and p95

This seems to give us a more accurate reading as we can calculate these two

* fix: cache hit rate not showing inside query details

* chore: chart bg colour adjust

So it contrasts a little better on light mode.

* feat: show selected query on other verticals

* feat: bring back symlink in advisors
2025-10-15 13:39:29 +01:00
kemal.earth 5c174b7ee6 fix(studio): dynamic size for query perf time consumed col (#39379)
* fix: dynamic size for query perf time consumed col

* fix: dynamic col types
2025-10-09 18:39:38 +01:00
kemal.earth 90976b7988 fix(studio): human readable formatting for total consumed times (#39011)
* fix: human readable formatting for total consumed times

* chore: accidental turkish spelling of performance

* fix: imports for renamed utils file

* feat: add tests for formatDuration util
2025-09-25 15:35:54 +01:00
kemal.earth 73b0b21bb7 feat(studio): combine time consumed cols in query perf (#38920)
* chore: remove forgotten dayjs helper

* feat: combined time consumed column
2025-09-22 14:54:24 +01:00
kemal.earth 19cfa66d9e feat(studio): move query details to sheet (#38815)
* feat: move query details to sheet

This moves the click through on Query Performance to a sheet as opposed to a resizable area. This gives us more space to play with and sets us up for the Query details revamp.

* fix: tabs font size

* style: expand size of sheet

* feat: hasOverlay prop for sheets

* feat: add optional overlay for sheets

* fix: closing only when clicking outside of rows

* style: width of panel on different  viewports

* fix: horizontal scroll for table

* fix: query queries label check in metrics
2025-09-19 15:00:59 +01:00
kemal.earth 3f6ae4b922 fix(studio): request for monospace back on query perf (#38825)
fix: request for monospace back on query perf
2025-09-18 17:41:16 +01:00
kemal.earth d70600c029 fix(studio): query performance tabular nums (#38819)
* fix: tabular numbers and right align query perf nums

* nit: time consumed column as well
2025-09-18 15:11:50 +01:00
kemal.earth cd07289476 fix(studio): query perf update label formatting and column name (#38778)
* chore: update rows read column label

* fix: toLocaleString for grid numbers
2025-09-17 16:24:55 +01:00
kemal.earth bc2dac6d68 feat(studio): add columns and update labels for query performance (#38744)
* feat: change calls label to count

This changes the column title for calls to count for clarity

* feat: add cache hit rate col and number formatting

Adds a cache hit rate column for each query as well as tidies up some number formatting.

* feat: add styling for 0 numbers

This makes anything marked as 0 feint in the table for easier parsing.

* chore: remove debug console log

* fix: silly next-env again

* nit: remove avg rows col

* nit: add toFixed to cache hit rate

* feat: add  tooltip for role column
2025-09-16 13:43:43 +01:00
kemal.earth 604be766a8 feat(studio): query performance metric cards (#38634)
* feat: remove tabs and unify columns

This removes the tabs from Query Performance with unified columns in the table.

* chore: remove unused imports

* chore: small adjustment to min max and mean time col size

* feat: original experiment with metric cards

* fix: height of table container on load

* feat: add percentage background for time consumed col

Adds a percentage based background colour for time consumed column and reshuffles some columns.

* feat: working metrics above rows

* feat: simplify stats + go back full width

* style: bring up percentage bar opacity

* chore: remove reportType again

* feat: add metric queries to reset function

* fix: type error for passing query metrics

* fix: query queries plural thing

* chore: remove next-env weirdness
2025-09-15 12:45:23 +01:00
kemal.earth 5fe3383c39 feat(studio): remove query performance tabs (#38606)
* feat: remove tabs and unify columns

This removes the tabs from Query Performance with unified columns in the table.

* chore: remove unused imports

* chore: small adjustment to min max and mean time col size

* chore: remove unused prop
2025-09-11 15:20:52 +01:00
kemal.earth 1bb9453b0c feat(studio): update query performance table ui (#38523)
* feat: tidy up query perf column headers

* feat: update col widths and which ones are sortable

This gives a reasonable column width to all cols as well as adds an option for us to filter out which columns we dont want to make the table sortable by.

* feat: column order and word wrapping for query

* feat: column data text align for numbers

* fix: pointer event was preventing index advisor icon popover

* feat: use code block instead of editor

Swapped Editor out for Code block as its less expensive and modified it to add pgsql syntax highlighting

* fix: small truncation issue

* chore: remove unused sort function

* fix: sort menu closing on first click

Sort menu of a column no longer disappears on first click

* feat: move sorting and ordering over to nuqs

This removes the usage of Next Router params and uses Nuqs instead for managing the QP table sorting and ordering.

* feat: add clear sorting button to filter bar

* chore: remove unused files

* fix: add highlighting for selected sort

* Nit update sort

* nit: smol styling update for direction

* feat: inian feedback on time based numbers

* fix: return number instead of string for total time

We were returning a string for total time percentage which meant the sorting was a little bit off

* Shift roles to nuqs

* chore: clean up

* fix: smaller viewport filter bar

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-09-10 17:40:25 +01:00
kemal.earth be994a1f62 feat(studio): simplify query performance filters (#38470)
* feat: remove redundant sort by

We had conflicting sort by dropdown which clashed with the individual column sorting itself. Either we do something similar to our table editor or leave it out for now. Opting to leave it out for now.

* fix: alignment of download dropdown

This aligns the download dropdown on the Query Performance page to look visually correct.

* feat: improved query search

This improves our query search in the Query Performance area. Now it does a local search through the available queries in the table. I removed it requesting the string from server for now. Simple

:x

q

* fix: increased width of filter popover

The roles filter popover is was too narrow for its contents. Increased teh size slightly.

* chore: remove commented out component

* chore: update placeholder for query filter

* fix: leftover prop on query performance page

* feat: reintroduce sql based query for search

Bringing back a hybrid approach - seems to work fine but also returns items that are not in your visible queries.

* feat: use debounce on search query

* feat: use nuqs instead of next router for roles

* Tiny optimization for debounced search to immediately run query if clearing input

* Add clear search CTA

* Remove client side searching

* Revert changes in useIndexInvalidation

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-09-09 12:18:32 +01:00
Taishi 97b631fff7 Add SQL syntax highlighting to Query Performance page (#38386)
* Add CodeBlock for SQL query display to add syntax highlight

* use monaco editor for better highlighting

* create `SqlMonacoBlock` component for SQL in detail panel

* add mean_time to most_time_comsuming queries

* make outline transparent

* Add keyboard navigation for query performance grid

* Stop default RDG behavior on arrow key navigation

* Update column minWidth values to remove horizontal scrollbar

* Load SqlMonacoBlock and Editor client-side only

- following a pattern in `SQLEditor.tsx`
2025-09-05 00:20:05 +00:00
kemal.earth 541c9f90cc fix(studio): query performance empty columns (#38437)
fix: query performance empty columns

The role and total time columns were not rendering the results that were there. Added a check to make sure they render.
2025-09-04 15:58:24 +01:00
Jordi Enric a023a59ec5 fix crash in query performance (#37758)
* fix crash

* undo query perf

* fix crash
2025-08-08 09:55:01 +02:00
Jonathan Summers-Muir 2815dac7e0 Feat/index suggestions inline (#35107)
* init

* hovercard

* adds button to install index advisor

* hover card now now insert indexes

* update

* moved hook

* align alert dialog to design syste,

* Update index-advisor.utils.ts

* shows all index statements now

* Update query-performance.tsx

* Some refactors

* Clean up

* Fix

* One last nit refactor

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-05-07 19:09:58 +08:00
Alaister Young e1eaa9844c fix: indexes in use (#33672)
* fix: indexes in use

* add error state for indexes in use

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-02-18 18:06:06 +08:00
Joshen Lim ce6a432504 Remove 2dp for ms values in query performance advisor (#33472) 2025-02-10 15:36:14 +08:00
Joshen Lim d586346e27 Chore/sentry fixes 211024 (#30003)
* Resolve https://supabase.sentry.io/issues/5808689343

* Fix SecurityStatus map key prop issue

* Fix FileExplorerHeader to use ButtonTooltip

* Fix https://supabase.sentry.io/issues/5998687405

* Fix https://supabase.sentry.io/issues/5414129652

* Fix https://supabase.sentry.io/issues/5414129652

* Fix map key issue in QueryPerformanceGrid

* Add whitelist error for sign up mutation

* Fix map key in DiskUsage

* Fix prop name in info-tooltip
2024-10-22 15:21:06 +08:00
Ivan Vasilov 09a62662d8 chore: Clean up ui-patterns imports (#29132)
* Switch all top-level imports for ui-patterns components to use specific components when importing.

* Remove the @ui-patterns shorthand since it works exactly the same without the @.

* More import fixes.

* Fix the ui-patterns tests.
2024-09-30 21:41:26 +02:00
Ivan Vasilov 05a542ccea chore: Migrate all feather icons to lucide icons (#29038)
* Add lucide-react to docs (to make the autocomplete work).

* Migrate the docs app icons.

* Migrate the ui-patterns.

* Remove the old icons from ui package.

* Migrate the www app from react-feather icons.

* Migrate all of studio icons.

* Migrate the only component in design-system.

* Fix an old import in ui package. Revert an import in docs app.

* Fix some pages in www.

* Remove unneeded files used in generation of icons.

* Fix a prettier error.

* Fix more issues in www.

* Fix an issue in Log Date picker.

* Replace all string sizes with number sizes because the icons grew in some cases.

* Fix more imports in security page.

* Fix an extra import.

* Remove the size prop from all icons if they're in a button and they match the button size.

* Minor fixes for docs and www.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-09-04 19:46:21 +08:00
Terry Sutton 6fa71c6c8e Chore/allow index advisor for postgrest queries (#27364)
* Run index advisor on postgrest queries

* Fix loading state
2024-06-20 17:47:30 +03:00
Joshen Lim 0d7137209c Chore/sentry fixes 280524 (#26828)
* UpgradeToPro remove project ref and org slug props

* Add check in Docs/ResourceContent

* Add conditional for accessing query property in QueryPerformanceGrid

* Add fallback value for lastPage in notifications-v2-query

* Simplify logic for finding api key in TerminalInstructions, EdgeFunctionDetails, [ref]/api/index

* Minor fixes and refactors

* Fix type issues
2024-05-31 10:52:18 +08:00
Ivan Vasilov 5cf8f30e23 chore: Remove obsolete flags (#22915)
* Remove showS3Connection flag.

* Remove showAnonUserFilter flag.

* Remove   enableVercelConnectionsConfig flag.

* Remove indexAdvisor flag.

* Remove queryPerformanceV2 flag.

* Remove unused files.

* Remove unneeded packages.

* Remove the v2 suffix from the query performance folder.
2024-04-22 09:38:41 +02:00