Skip to content

fix(graphs): historical ranges (30 min … 30 d) draw their data - #3

Merged
2shiraz merged 1 commit into
mainfrom
build/phase-0-1
Oct 16, 2026
Merged

2shiraz merged 1 commit into
mainfrom
build/phase-0-1

Conversation

@2shiraz

@2shiraz 2shiraz commented Oct 16, 2026

Copy link
Copy Markdown
Owner

On the Graphs tab only Live drew lines. 30 min, 1 h, 6 h, 24 h, 7 d and 30 d showed empty charts, with only the legend numbers filled in.

Cause

The chart is reused when you switch ranges, but two settings were fixed when it was first built in Live mode:

  • the x-axis window, set to 15 minutes;
  • how gaps between points are drawn.

Every historical range was therefore drawn into a 15-minute window, so almost nothing was visible.

Fix

  • Chart.svelte:
    • The chart rebuilds when switching between Live and a historical range.
    • The x range follows the selected window.
    • On historical ranges, lines join across empty buckets.
    • Isolated points (sparse data, such as a fresh install viewing 7 d) are drawn as dots.
  • metrics.Query: the 1 s history lives in memory, so after a restart (for example an update) the 30 min and 1 h views only showed the minutes since the restart. They now fill the older part of the range from the persisted 1-minute rollups. Live stays pure 1 s data.

Verification

  • New regression test TestQueryFillsRingGapFromRollups. It fails without the fix and passes with it.
  • golangci-lint reports 0 issues, go test ./... passes, and npm run check is clean.
  • Browser check against a live stack:
    • open Graphs (Live), then switch to 30 min, 1 h and 7 d: each draws its full window with data;
    • switch back to Live: it works as before;
    • after a restart, 30 min and 1 h still show the history from before it.
  • Playwright e2e: 2/2 pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_0159fEExV6P6AdgP7HbsJNBc


Generated by Claude Code

The chart instance is reused when the range changes, but its x window
(15 min for Live) and gap handling were fixed at build time, so every
historical range was drawn into the Live window and looked empty. The
chart now rebuilds when switching between Live and historical ranges,
and the x range follows the selected window.

Also: after a restart the in-memory 1 s history is empty, so 30 min and
1 h now fill the older part of the range from the persisted 1-minute
rollups; lines join across empty buckets on historical ranges, and
isolated points are drawn as dots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159fEExV6P6AdgP7HbsJNBc
@2shiraz
2shiraz merged commit eedb39a into main Oct 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants