Notebooks: migrate the Metrics tab into notebooks to unify dashboards (future, not urgent)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 29
- Forks
- 39
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 4
Description
The Metrics tab (src/scenes/Editor/Metrics/, persisted as BufferType.METRICS with metricsViewState on the Buffer) is conceptually a sibling of notebooks: a grid of time-series charts persisted on a Buffer, with refresh. We want to fold Metrics into Notebooks so there's a single dashboard surface. Explicitly future / not urgent — don't block notebook work on it.
What Metrics is today
- Buffer carries
metricsViewState(src/store/buffers.ts:50-57): globaldateFrom/dateTo,refreshRate(AUTO/OFF/1s/5s/10s/30s/1m),sampleBy,viewMode, andmetrics: Metric[]. - Each
Metricis a predefined widget (not arbitrary SQL):metricType+tableId+ color/position. The widget set lives insrc/scenes/Editor/Metrics/widgets/(WAL throughput/latency, row throughput, write amplification, avg txn size); each widget'sgetQuery()builds SQL from tableId + sampleBy + time range (src/scenes/Editor/Metrics/types.ts). - Charts render with uPlot (
createUplotOptions.ts,graph.tsx) under a global date-range picker, refresh rate, and sampleBy.
How that differs from notebooks
Notebooks use echarts (src/scenes/Editor/Notebook/CellChart/), arbitrary SQL per cell, and per-cell auto-refresh (no global date range / sampleBy); metrics are MCP-invisible while notebooks are MCP-controllable.
Prerequisite
We don't have a global (notebook-level) time-range or refresh rate today — notebooks only have per-cell auto-refresh, whereas Metrics is built entirely around global date-range + refresh + sampleBy controls. When these global controls are added (notebook-level time-range, and the notebook-level refresh rate from #577), the migration becomes feasible.
Migration shape
A metrics dashboard becomes a notebook of chart cells, the predefined widgets become SQL chart cells seeded from the widget query templates, and the global date-range / refresh / sampleBy become notebook-level controls. Needs a one-time data migration of persisted metricsViewState → notebookViewState (and BufferType.METRICS → NOTEBOOK).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/scenes/Editor/Metrics/, src/store/buffers.ts, and src/scenes/Editor/Metrics/types.ts, then compare the notebook cell and chart entry points under src/scenes/Editor/Notebook/CellChart/. Confirm the notebook-level controls from #577 before planning the migration. Done means Metrics dashboards can be represented as notebook chart cells, with persisted metrics state migrated to notebook state and the old buffer type retired.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100