Commit Graph
4 Commits
Author SHA1 Message Date
Jordi Enric 833a875ea2 fix(studio): friendly database metric errors DEBUG-155 (#52216)
## Problem

The Database section of Observability displays raw infrastructure API
errors in metric cards, making failures confusing and repetitive.

## Fix

Show one friendly alert with refresh, support, and service-status
guidance when the infrastructure request fails. Keep Slow Queries
visible, and show “Unable to load” only on affected cards for partial
failures while preserving healthy metrics.

The Overview Refresh button now invalidates the active project’s
connection-limit query. Previously it used a cache key that matched no
active query, so Peak Connections could stay on “Unable to load” while
the other cards refreshed.

Consolidates and supersedes #47491 and #47495, adapted to the current
batched metrics implementation.

## How to test

- Open Observability and verify that successful database metrics still
render.
- Simulate a failed infrastructure request. Expect one friendly alert,
no raw backend message, and Slow Queries still visible.
- Simulate an individual metric or connection-limit failure. Expect only
the affected card to show “Unable to load”.

- With the connection-limit request failing, click **Refresh** and
confirm that Peak Connections shows “Unable to load”. Restore the
response and click **Refresh** again. The card should show the peak and
limit without a browser reload.

## QA results

- **Hosted Refresh recovery passed on `ee646999af`.** After the
connection-limit request recovered, one click sent a new request and
replaced “Unable to load” with `6/90`. The other five hosted cases
passed on `dbf78487f5`. [Automated QA
review](https://github.com/supabase/supabase/pull/52216#pullrequestreview-6169329677)
- **Local Chromium recovery passed on the same commit.** With a
simulated HTTP 500 followed by success, Refresh retried the query and
displayed `12/100`. CPU, Memory, and Disk remained healthy.
- All 52 focused tests passed with retries disabled and shuffled order.
The recovery test failed with the original Refresh handler. Studio
typecheck passed. GitHub reported 38 successful checks and six skipped
checks.

Fixes
https://linear.app/supabase/issue/DEBUG-155/frontend-should-render-nice-error-message-on-infra-monitoring-api

## QA screenshots

### Peak Connections before and after the Refresh fix

**Before · `dbf78487f5`.** Peak Connections still showed “Unable to
load” after two Refresh clicks, even as the other metrics reloaded.

![Peak Connections stuck on Unable to load after
Refresh](https://k6dwnfm8zepsmdni.public.blob.vercel-storage.com/qa/wrun_41M8XTANCW0GQ8139AY6ECPK81/1796297469653-screenshot-1796297456016.png)

**After · `ee646999af`.** Once the connection-limit request could
succeed, the next Refresh click restored Peak Connections to `6/90`.

![Peak Connections showing 6/90 after in-app
Refresh](https://k6dwnfm8zepsmdni.public.blob.vercel-storage.com/qa/wrun_41M8XTANCW0GQ8139AY6ECPK81/1796299167534-screenshot-1796299160944.png)

### Local browser with HTTP overrides

Actual PR component at `dbf78487f5`, rendered in a local fixture harness
at a 1440 × 900 viewport. Playwright intercepted the infrastructure API
request; these are local simulated error states, not hosted-preview
captures.

**Full request failure:** one friendly alert; raw backend details are
hidden and Slow Queries remains visible.

![Full request failure — local HTTP
override](https://github.com/user-attachments/assets/f9b85b1d-f836-47ce-ad48-bab13e558079)

**Partial failure:** only Disk IO Budget shows “Unable to load”; healthy
metrics and Slow Queries remain visible.

![Partial metric failure — local HTTP
override](https://github.com/user-attachments/assets/f7dbc088-d505-4f20-8a55-45d832b828a8)

**Recovery:** after restoring a successful response and reloading, all
metric cards render normally.

![Healthy recovery — local HTTP
override](https://github.com/user-attachments/assets/34d3332e-717b-47ff-ba56-e00128fa474c)

### Verified hosted preview

Studio staging deployment for `dbf78487f5`, 1440 × 900. All database
metric cards and Slow Queries return after Refresh.

![Overview after
Refresh](https://github.com/user-attachments/assets/67304cac-3dfd-4afe-b717-0a1fa12a30ba)

The CPU card opens the Database report and preserves Last 24 hours.

![Database report opened from a metric
card](https://github.com/user-attachments/assets/c70eb7c8-4151-4080-ba6c-69efb675d7ab)
2026-12-03 14:03:33 +01:00
Alaister YoungandAlaister Young df798783e1 [FE-5108] (part 4) refactor(studio): migrate integrations, settings & observability off next/link (#54307)
Part 4 of a 6-PR stack migrating all `next/link` imports in
`apps/studio` onto TanStack Router's `Link` (or plain `<a>` for known
external URLs) and removing `compat/next/link.tsx`.

| Part | PR | Scope |
| --- | --- | --- |
| 1 | #54304 | `data/prefetchers/PrefetchableLink.tsx` and
`components/ui/**` |
| 2 | #54305 | `components/layouts/**` and top-level shell components |
| 3 | #54306 | Database, TableGridEditor, Storage, SQLEditor,
BranchManagement, Branching, Functions, Realtime |
| **4** | **#54307 ← this PR** | **Integrations, Settings,
Observability, LogDrains, Issues, Linter, Reports, QueryPerformance,
QuerySources, ConfigDrift, DiskManagement, Compute** |
| 5 | #54308 | Remaining `components/interfaces/**` (Org, Billing, Auth,
Support, Home, SignIn, ConnectSheet, etc.) |
| 6 | #54309 | Remove `compat/next/link.tsx` shim, Vite alias, and
update basePath tests/docs |

Migrates
`components/interfaces/{Integrations,Settings,Observability,LogDrains,Issues,Linter,Reports,QueryPerformance,QuerySources,ConfigDrift,DiskManagement,Compute}/`
off `next/link`.

**Changed:**

- Replaced `next/link` across all 72 files in Integrations, Settings,
Observability, LogDrains, Issues, Linter, Reports, QueryPerformance,
QuerySources, ConfigDrift, DiskManagement, and Compute interfaces
- Updated legacy permanent-redirect hrefs (`/settings/database` →
`/database/settings`, `/settings/vault/secrets` →
`/integrations/vault/secrets`, `/reports/database#database-size-report`
→ `/observability/database#database-size-report`) to canonical routes
- Flattened legacy nested `<Link><a>...</a></Link>` markup in
`DatabaseReadOnlyAlert.tsx` and dropped `passHref` in
`Integrations/Queues/QueueTab.tsx`
- Standardized external `target="_blank"` anchors with `rel="noreferrer
noopener"`, switched `ObservabilityOverviewFooter.tsx` to `InlineLink` +
`DOCS_URL`, and applied `InlineLinkClassName` to the typed billing links
in `DatabaseReadOnlyAlert.tsx` per review feedback
- Removed `vi.mock('next/link', ...)` from
`Settings/General/Project.test.tsx` and
`MobileIssuesNavigation.platform.test.tsx`

Addresses
[FE-5108](https://linear.app/supabase/issue/FE-5108/replace-the-nextlink-shim-with-tanstack-link)

## To test

- [ ] Navigate across Integrations (marketplace, cron, queues, wrappers,
Vercel/GitHub), Settings (database, infrastructure, read replicas,
logs), Observability, Issues, and Compute pages
- [ ] Verify Logs Preview → Logs Explorer links preserve multi-line SQL
queries in search params
- [ ] Verify billing and database-size links preserve query parameters
and hash fragments

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 17:02:11 +08:00
Jordi Enric 4825c6d9f5 fix(studio): clarify disk IO balance FDBKPRI-2885 (#51943)
## Problem

Infrastructure and Observability label consumed disk IO burst credits as
“Disk IO,” so a value of 1% appears inconsistent with a remaining
balance of 99% in AWS or Grafana.

Both surfaces request `disk_io_consumption`, which is the inverse of
`disk_io_budget`.

## Fix

Show `disk_io_budget` as “Disk IO balance” and explain that it
represents the lower of the remaining throughput and IOPS burst
balances. Infrastructure shows the lowest sampled balance over seven
days; Observability shows the selected-window average.

Keep Infrastructure's overall Compute score based on consumed credits,
so a full balance stays healthy and a low balance still warns. Missing
balance remains unavailable.

Update the compute and disk guide and disk IO troubleshooting page to
explain the remaining balance, its direction, and the different
aggregation windows.

## How to test

- Open Infrastructure settings for a project with burstable IO. Verify
the balance headline and chart show remaining credits, with 100% full
and 0% exhausted.
- Open Observability and verify “Disk IO balance” shows the average
remaining balance for the selected window.
- Hover the labels to check the explanation and aggregation window.
- Verify a high balance does not inflate Compute usage, a low balance
raises the warning, and missing balance does not appear as 0% or 100%.
- Focused unit and MSW component tests: 79 passed, including shuffled
runs with retries disabled; regression mutations caught wrong metric
selection, reversed pressure, and maximum-versus-minimum selection.

## Validation

Studio typecheck, changed-file ESLint, and Prettier pass locally.
Verified both surfaces on the deployed preview, including Observability
refresh and the balance tooltip.

Documentation formatting and review pass. The local markdown build is
blocked by missing generated federated content and its GitHub
credentials; docs CI validates the deployed build.

## Screenshots

Same project on `supabase.green` (before) and the PR preview (after),
captured October 20. Infrastructure uses the same seven-day window;
Observability uses Last 24 hours.

### Infrastructure

| Before | After |
| --- | --- |
| ![Infrastructure
before](https://github.com/user-attachments/assets/be38665c-702d-4c93-854a-a4c7c6f799a2)
| ![Infrastructure
after](https://github.com/user-attachments/assets/41d45ce1-0df5-41e5-8e3f-63c14fd30dcc)
|

### Observability

| Before | After |
| --- | --- |
| ![Observability
before](https://github.com/user-attachments/assets/5a4493f5-f7b1-4bdb-9783-f70f076b8706)
| ![Observability
after](https://github.com/user-attachments/assets/99fea639-4fc7-4fd1-98cd-5a58b69c4ffa)
|

Observability balance explanation:

![Observability balance
tooltip](https://github.com/user-attachments/assets/5c327daa-4eb7-4752-8e0c-1cbc2f64dd86)

Fixes FDBKPRI-2885
2026-10-21 15:41:56 +02:00
Chris Opland 509afd0bf0 fix(o11y): support partial metric loading (#50867) 2026-09-25 12:20:23 -05:00