Skip to content

Home chart drifts from KPIs when a provider filter is active (analytics endpoint missing provider param) #764

Description

@cristim

Summary

The analytics endpoint that backs the Home page Savings-over-time chart accepts an account_ids filter but no provider param. PR #746 brought chart and KPI cards into account-filter parity, but when the user applies a provider filter (e.g. only AWS, only Azure), the KPIs above the chart correctly scope to the chosen provider while the chart aggregates across all providers — so the numbers drift visibly.

Repro

  1. Open the Home page.
  2. Apply a provider filter chip (e.g. "Azure").
  3. Compare the "Potential Monthly Savings" KPI to the sum of the chart's last-N-days datapoints.
  4. The KPI scopes to Azure; the chart still aggregates AWS + Azure + GCP.

Fix

Add a provider (or providers[] for multi-select) query param to the analytics handler. Mirror the same filter semantics as the KPI endpoint so the two sources of truth share the same scoping rules.

Suggested touchpoints (verify before editing):

  • internal/api/handler_dashboard.go (or wherever getSavingsOverTime / the analytics route lives)
  • frontend/src/dashboard.ts — pass provider alongside account_ids when fetching the chart series

Add a regression test asserting that with a provider filter active, the chart datapoint sums match the KPI value for the same range (within rounding epsilon).

Notes

PR #746 documented this as a known limitation in the dashboard.ts comments; this issue tracks the follow-up to actually close the gap.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions