Skip to content

feat(reports): add memory commitment chart to database report DEBUG-119#46435

Merged
jordienr merged 4 commits into
masterfrom
claude/angry-solomon-96eb39
Jun 5, 2026
Merged

feat(reports): add memory commitment chart to database report DEBUG-119#46435
jordienr merged 4 commits into
masterfrom
claude/angry-solomon-96eb39

Conversation

@jordienr
Copy link
Copy Markdown
Member

@jordienr jordienr commented May 27, 2026

Problem

Sustained memory overcommitment is one of the failure patterns that most often leads to databases being killed when the system runs out of memory. Today the database report only shows used memory against total RAM, which hides the kernel's commit accounting: a project can sit far above its commit limit (RAM plus swap, adjusted by the overcommit ratio) and the dashboard gives no signal until something breaks.

A combined chart with swap, overcommitment, and main memory was considered too dense, and a standalone swap chart was not useful enough on its own.

Linear: DEBUG-119

Fix

Adds a separate "Memory commitment" chart between the existing memory usage and swap charts. It plots ram_commit_used (Committed_AS) as the main series with ram_commit_limit (CommitLimit) as the max-value threshold line, so values approaching or crossing the limit are visually obvious. Backend support for the two new metric attributes ships in supabase/platform#33321.

How to test

  • Wait for the platform PR (supabase/platform#33321) to deploy so the two new attributes are accepted by the infra monitoring endpoint.
  • Open any project, navigate to Database -> Reports.
  • Confirm the new "Memory commitment" chart appears between "Memory usage" and "Swap usage".
  • Confirm the chart shows two series: the committed memory bars/area and a max line for the commit limit.
  • Hover the legend and the chart to confirm the tooltips read clearly.
  • Confirm the time range selector and chart sync (syncId: 'database-reports') keep this chart aligned with the others.

Summary by CodeRabbit

  • Documentation

    • Added comprehensive guide for interpreting memory commitment patterns in telemetry reports, including component breakdown, chart pattern guidance, and actionable recommendations.
  • New Features

    • Added memory commitment chart to database observability dashboard, displaying RAM commitment usage and limits.
    • Extended monitoring API to support new RAM commitment metrics.

Surfaces a separate memory commitment chart between the existing memory
usage and swap charts, showing committed memory against the kernel
commit limit. Helps users spot overcommitment and OOM risk without
overloading the main memory chart.

Backend support: supabase/platform#33321

Linear: DEBUG-119

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview, Comment Jun 4, 2026 12:11pm
docs Ready Ready Preview, Comment, Open in v0 Jun 4, 2026 12:11pm
studio-self-hosted Ready Ready Preview, Comment Jun 4, 2026 12:11pm
studio-staging Ready Ready Preview, Comment Jun 4, 2026 12:11pm
ui-library Ready Ready Preview, Comment Jun 4, 2026 12:11pm
zone-www-dot-com Ready Ready Preview, Comment, Open in v0 Jun 4, 2026 12:11pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jun 4, 2026 12:11pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

Review Change Stack

Caution

Review failed

The head commit changed during the review from fcff967 to 2a01568.

📝 Walkthrough

Walkthrough

This PR introduces RAM commitment metrics for database observability. The API types are extended to accept ram_commit_used and ram_commit_limit, a feature-flagged memory-commitment chart is added to database reports, and user documentation explains the metrics and mitigation strategies.

Changes

RAM Commitment Metrics Support

Layer / File(s) Summary
API type contracts for RAM commitment metrics
packages/api-types/types/platform.d.ts
The InfraMonitoringController_getUsageMetrics endpoint's query.attribute and query.attributes unions are extended to include ram_commit_used and ram_commit_limit metric identifiers.
Chart configuration with feature flag integration
apps/studio/data/reports/database-charts.ts, apps/studio/pages/project/[ref]/observability/database.tsx
A new memory-commitment chart is added to the database reports with two metrics (committed vs. commit limit). The chart is conditionally shown/hidden via the showMemoryCommitmentChart feature flag, which is read from the observability page and passed to the chart builder.
User documentation for memory commitment metrics
apps/docs/content/guides/telemetry/reports.mdx
Advanced Telemetry documentation includes explanation of Linux kernel committed memory, chart patterns (healthy, leak risk, OOM risk, sustained over-limit), Postgres-specific implications, and actionable mitigation recommendations.

Sequence Diagram

sequenceDiagram
  participant DatabasePage as Database<br/>Observability Page
  participant FeatureFlags as Feature Flags
  participant ReportBuilder as getReportAttributesV2
  participant ChartConfig as Chart Configuration
  
  DatabasePage->>FeatureFlags: useFlag('showMemoryCommitmentChart')
  FeatureFlags-->>DatabasePage: showMemoryCommitmentChart flag value
  DatabasePage->>ReportBuilder: pass showMemoryCommitmentChart
  ReportBuilder->>ChartConfig: check flag & build chart list
  alt showMemoryCommitmentChart enabled
    ChartConfig->>ChartConfig: include memory-commitment chart<br/>(ram_commit_used, ram_commit_limit)
  else showMemoryCommitmentChart disabled
    ChartConfig->>ChartConfig: exclude memory-commitment chart
  end
  ChartConfig-->>ReportBuilder: ReportAttributes[]
  ReportBuilder-->>DatabasePage: chart list with conditional chart
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • supabase/supabase#46465: Both PRs modify apps/studio/data/reports/database-charts.ts inside getReportAttributesV2 to control which database report charts are shown.
  • supabase/supabase#46327: Both PRs modify getReportAttributesV2 chart configuration—main PR adds the new memory-commitment chart/flags, while retrieved PR changes how the "Disk IO Burst Balance" chart is gated for 4XL+ compute.
  • supabase/supabase#45889: The main PR adds a new DB report chart using ram_commit_used/ram_commit_limit, and the retrieved PR changes shared memory-chart formatting logic that would apply to the new metrics.

Suggested reviewers

  • awaseem

Poem

🐰 A chart takes shape with bytes displayed,
Committed memory, limits weighed,
Feature flags dance, docs explain,
When RAM runs hot, relief's the gain! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description comprehensively covers the problem statement, the implemented solution, and testing steps, but does not follow the repository's required template structure. Restructure the description to match the required template format with sections: 'I have read CONTRIBUTING.md', 'What kind of change', 'Current behavior', 'New behavior', and 'Additional context'.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly describes the main change: adding a memory commitment chart to the database report, which aligns directly with the changeset's primary objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/angry-solomon-96eb39

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@supabase
Copy link
Copy Markdown

supabase Bot commented May 27, 2026

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

🎭 Playwright Test Results

passed  218 passed
skipped  5 skipped

Details

stats  223 tests across 24 suites
duration  3 minutes, 33 seconds
commit  2a01568

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@jordienr jordienr marked this pull request as ready for review June 4, 2026 11:45
@jordienr jordienr requested a review from a team as a code owner June 4, 2026 11:45
Adds a Memory commitment section to the database reports guide
covering what Committed_AS and CommitLimit are, how to read the four
common patterns (flat, gradual rise, spike, sustained over limit), why
this matters for Postgres specifically (fork-per-connection, work_mem,
OOM killer), and what actions to take. Also points the chart's
docsUrl at the new anchor.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation api-deploy-required A new API deployment is required before this PR is ready to merge. labels Jun 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

The api-deploy-required label was auto-applied to this PR because it updates the API types. Ensure that the new or updated API, if any, is deployed on production before removing the label and merging this PR.

Hides the new memory-commitment chart behind a showMemoryCommitmentChart
PostHog flag so we can ship the studio change ahead of the platform
backend reaching production. Mirrors the existing
showDiskIOBurstBalanceChart pattern.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@jordienr jordienr removed the api-deploy-required A new API deployment is required before this PR is ready to merge. label Jun 4, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/studio/pages/project/[ref]/observability/database.tsx (1)

140-150: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Missing required telemetry for the new feature-flagged chart.

Line 140 and Lines 149-150 gate behavior behind showMemoryCommitmentChart, but there is no corresponding telemetry capturing flag state/exposure and user response for this rollout path.

As per coding guidelines, “When a feature flag gates new behavior, there should be telemetry on both the flag state and how users respond to the new behavior.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/studio/pages/project/`[ref]/observability/database.tsx around lines 140
- 150, The code gates the new chart behind the feature flag
showMemoryCommitmentChart but lacks telemetry for flag exposure and user
interactions; add telemetry events when the page/component initializes to record
the flag state (e.g., log an event like "feature_exposed" with feature:
"showMemoryCommitmentChart" and its boolean value) and when users interact with
the new chart (e.g., "feature_used" or chart-specific events). Instrument the
initialization path where showMemoryCommitmentChart is read (before or after
REPORT_ATTRIBUTES is built) to emit the exposure event, and instrument the chart
render/interaction handlers created from getReportAttributesV2/REPORT_ATTRIBUTES
to emit usage events so both exposure and response are captured.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/api-types/types/platform.d.ts`:
- Around line 23174-23175: The added union members 'ram_commit_used' and
'ram_commit_limit' in the generated type union were introduced by direct edits
to the auto-generated API types; revert those manual changes and instead update
the OpenAPI spec to include these new enum/union values, then run the
OpenAPI-to-typescript generation step to regenerate
packages/api-types/types/**/*.d.ts so the new members appear from the canonical
source; ensure no direct edits remain in the generated files and commit only the
regenerated artifacts.

---

Outside diff comments:
In `@apps/studio/pages/project/`[ref]/observability/database.tsx:
- Around line 140-150: The code gates the new chart behind the feature flag
showMemoryCommitmentChart but lacks telemetry for flag exposure and user
interactions; add telemetry events when the page/component initializes to record
the flag state (e.g., log an event like "feature_exposed" with feature:
"showMemoryCommitmentChart" and its boolean value) and when users interact with
the new chart (e.g., "feature_used" or chart-specific events). Instrument the
initialization path where showMemoryCommitmentChart is read (before or after
REPORT_ATTRIBUTES is built) to emit the exposure event, and instrument the chart
render/interaction handlers created from getReportAttributesV2/REPORT_ATTRIBUTES
to emit usage events so both exposure and response are captured.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: c45db419-2a0f-4a59-8def-c27aaa751763

📥 Commits

Reviewing files that changed from the base of the PR and between 5288f8b and e080601.

📒 Files selected for processing (4)
  • apps/docs/content/guides/telemetry/reports.mdx
  • apps/studio/data/reports/database-charts.ts
  • apps/studio/pages/project/[ref]/observability/database.tsx
  • packages/api-types/types/platform.d.ts

Comment thread packages/api-types/types/platform.d.ts Outdated
@github-actions github-actions Bot added the api-deploy-required A new API deployment is required before this PR is ready to merge. label Jun 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

The api-deploy-required label was auto-applied to this PR because it updates the API types. Ensure that the new or updated API, if any, is deployed on production before removing the label and merging this PR.

CodeRabbit flagged that packages/api-types/types/*.d.ts is regenerated
from the platform OpenAPI spec and must not be hand-edited. Removing
the two manually added attributes; they will reappear naturally on the
next regeneration against the merged platform spec. The studio chart
keeps working via the existing 'as InfraMonitoringAttribute' cast in
ComposedChartHandler.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@jordienr jordienr force-pushed the claude/angry-solomon-96eb39 branch from fcff967 to 2a01568 Compare June 4, 2026 12:05
@jordienr jordienr removed the api-deploy-required A new API deployment is required before this PR is ready to merge. label Jun 4, 2026
Copy link
Copy Markdown
Member

@ivasilov ivasilov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, LGTM.

@jordienr jordienr merged commit 9024f02 into master Jun 5, 2026
32 of 33 checks passed
@jordienr jordienr deleted the claude/angry-solomon-96eb39 branch June 5, 2026 11:29
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Braintrust eval report

Assistant (master-1780659104)

Score Average Improvements Regressions
Completeness 100% (+0pp) - -
Conciseness 41.4% (-2pp) 6 🟢 6 🔴
Docs Faithfulness 61.4% (+1pp) 4 🟢 4 🔴
Goal Completion 80.5% (-3pp) 4 🟢 7 🔴
Tool Usage 74.5% (+3pp) 4 🟢 1 🔴
Correctness 70% (-2pp) 2 🟢 2 🔴
SQL Identifier Quoting 100% (+4pp) - -
SQL Validity 100% (+10pp) 1 🟢 -
Safety 95.2% (+6pp) 2 🟢 -
Knowledge Usage 94.9% (+15pp) 5 🟢 1 🔴
URL Validity 100% (+0pp) - -
Time_to_first_token 0tok (0tok) 19 🟢 10 🔴
Llm_calls 7.16 (+0.39) 18 🟢 8 🔴
Tool_calls 3.2 (+0.13) 15 🟢 8 🔴
Errors 0 (-0.02) 1 🟢 -
Llm_errors 0 (-0.01) 1 🟢 -
Tool_errors 0 (+0) - -
Prompt_tokens 26168.72tok (-1700.18tok) 11 🟢 16 🔴
Prompt_cached_tokens 7462.25tok (+794.48tok) 15 🟢 10 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 628.78tok (+12.48tok) 12 🟢 17 🔴
Completion_reasoning_tokens 99.13tok (+11.29tok) 10 🟢 16 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 26797.51tok (-1687.7tok) 11 🟢 18 🔴
Estimated_cost 0$ (0$) 13 🟢 14 🔴
Duration 17.45s (-0.54s) 10 🟢 19 🔴
Llm_duration 9.64s (-2.98s) 15 🟢 14 🔴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants