Skip to content

Add 14d time window to surface full free plan data - #25

Merged
maquchizi merged 9 commits into
mainfrom
add-14d-time-window-to-surface-full-free-plan-data
Jul 27, 2026
Merged

Add 14d time window to surface full free plan data#25
maquchizi merged 9 commits into
mainfrom
add-14d-time-window-to-surface-full-free-plan-data

Conversation

@maquchizi

Copy link
Copy Markdown
Collaborator

What & why

On the free Grafana Cloud plan (METRICS_RETENTION_DAYS=14), the largest window with an honest summary figure was 7d30d/1y correctly render . That left the retained 8–14 day slice with no headline figure anywhere, even though the per-site charts already plot it.

This PR adds a 14d window so the full free-plan retention gets a properly-labeled summary, and makes both the overview and detail pages open on the largest window retention actually covers (14d on the free plan, 30d when retention is unlimited). Along the way it centralizes the window definitions and hardens the detail-route window parsing.

Builds on the METRICS_RETENTION_DAYS work (#13) — the clamping that makes 14d show real data already existed in fetchSiteHistory.

Closes #18

Key changes:

  • 14d window ({ key: "14d", label: "14 days", seconds: 1_209_600 }, 84 × 4h buckets) added to the single WINDOWS source. Everything window-generic (query fan-out, coverage clamp, mock data) flows through it with no special-casing. Per-site uptime grid widened to sm:grid-cols-5.
  • Retention-aware default extracted into a shared, pure defaultWindow(retentionDays) in lib/types.ts, reused by both Overview and the detail page so the two stay in step (no more hardcoded "7d").
  • Centralized window definitions: WINDOWS now carries barCount (removing the parallel BAR_COUNT map in lib/buckets.ts), WindowKey is derived from it, and new isWindowKey / windowFromParam helpers own URL ?window= resolution.
  • Detail window query reuse: generateMetadata and the page now resolve the window once via the shared helper (so metadata fetches the correct window instead of always 7d), handle repeated ?window= params safely, and set aria-current="page" on the active tab.
  • Bug fix: reworked the uptime-bar SVG <title> (mixed text + expression children compiled to a 4-element array) into a single template string, clearing a React runtime warning.
  • Docs: docs/configuration.md and README.md describe 14d alongside the retention section.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / chore

Checklist

Notes for reviewers

  • The change is deliberately window-generic — coveredWindows(), windowWithinRetention(), the query fan-out, and mock data all iterate WINDOWS, so 14d needed no branching. Worth confirming that assumption still holds.
  • defaultWindow returns 30d when covered, else the largest covered window — so the overview default under unlimited retention is unchanged; only capped-retention plans shift to 14d.
  • Verified in the browser under METRICS_RETENTION_DAYS=14: overview and detail both open on 14d, the uptime grid shows 14 days = 100% with 30d/1y as , and the detail chart plots the full ~14-day span. Grid lays out cleanly at 5 columns (desktop) and wraps 2+2+1 on mobile.

@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
probeview Ready Ready Preview, Comment Jul 27, 2026 12:22pm

Request Review

@maquchizi
maquchizi requested a review from a team July 27, 2026 10:08
@kilemensi

Copy link
Copy Markdown
Member

@claude review

@kilemensi

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a94503473c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/types.ts Outdated
Comment thread playwright.config.ts Outdated

@kilemensi kilemensi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code LGTM!

Comment thread components/Overview.test.tsx Outdated
@maquchizi
maquchizi force-pushed the add-14d-time-window-to-surface-full-free-plan-data branch from 1301d52 to ac7a971 Compare July 27, 2026 12:11
@maquchizi
maquchizi merged commit 913a002 into main Jul 27, 2026
5 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.

[Feature] Add a 14d time window to surface the full free-plan retention

2 participants