Skip to content

[Bug] Long time windows report 100% uptime when data is beyond the plan's retention #12

Description

@maquchizi

What happened

On the free Grafana Cloud plan, only 14 days of metrics are retained. Yet the status page reports 100% uptime over the 30-day and 1-year windows, which is not true - there are known outages, and there simply isn't a year of data to back the figure.

Example: api.sensorsafrica.africa shows 100% uptime for the last year.

The uptime percentages are computed with PromQL like rate(probe_all_success_sum[1y]) / rate(probe_all_success_count[1y]). A range vector only sees the samples that exist, so with 14 days of retention the "1 year" and "30 day" ratios are actually computed over ~14 days of data but presented under a 1y/30d label. Because that retained window happens to be all-success, it renders a confident, false 100%. The same misleading number appears in the overview list, the per-site uptime grid, and the window selector's charts.

What you expected

The UI should be honest about coverage. Since the app is read-only and can't recover dropped data, windows longer than what's retained should not be presented as fully covered — e.g. show an "insufficient data" marker plus a note ("only the last 14 days of data are retained on this plan") instead of a fabricated 100%.

Steps to reproduce

  1. Deploy against a Grafana Cloud stack with 14-day metrics retention (free plan).
  2. Open a service detail page and switch the window to 1y (or 30d), e.g. /site/api-sensorsafrica-africa?window=1y.
  3. Observe uptime reported as 100% despite there being only ~14 days of underlying data and known outages within them.

Environment

  • App version / commit: 7ad4ff8
  • Node version: 24.x
  • Running mode: [x] live (Grafana) [ ] sample data (MOCK=1 / no creds)
  • Host: [ ] local [x] Vercel [ ] other (specify) — https://status.codeforafrica.org

Diagnostics

If this involves live data, please run and paste the relevant output:

node --env-file=.env.local scripts/introspect.mjs

⚠️ Do not paste your GRAFANA_PROM_TOKEN or any secret. Redact tokens and
instance IDs.

Logs / screenshots

The 1y view of api.sensorsafrica.africa shows 100% uptime: https://status.codeforafrica.org/site/api-sensorsafrica-africa?window=1y

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions