Skip to content

Switch charts to utilize Prometheus API endpoint

Problem to solve

Currently we have a single backend API call which returns all of the data needed to render an entire dashboard:

  • What charts to display
  • What order to display them in
  • The timeseries data for each chart

This has a number of drawbacks:

  • Extremely large API response, 400k+
  • Dashboards loads all at once, all or nothing.
  • The backend needs updates to support new dashboard features

Target audience

Further details

Proposal

We should instead have two API endpoints:

  • The layout of the dashboard and what charts should be present
  • Prometheus API endpoint to fetch the underlying timeseries data, one call per series/query

This would allow the backend to primarily focus on the dashboard and layout, and the queries can largely be proxied directly to Prometheus with the new Prometheus API endpoint: https://gitlab.com/gitlab-org/gitlab-ce/issues/58375

We can get here in a series of steps:

  1. Build the Prometheus endpoint: https://gitlab.com/gitlab-org/gitlab-ce/issues/58375
  2. Introduce a new dashboard endpoint, which will be designed to underpin the flexible canvas, but for now just return the same dashboards as before
  3. Update the charting components to directly hit the Prometheus endpoint

This issue can serve to capture 2 and 3, which will largely have to be done together to be utilized.

Permissions and Security

Documentation

What does success look like, and how can we measure that?

Links / references

Edited by Joshua Lambert