Skip to content

Add embedding support to metrics_dashboard

Sarah Yasonik requested to merge embedded-metrics-be into master

What does this MR do?

Overview: We want to render (inline) two charts from the metrics dashboard (CPU & Memory) when a link to the metrics dashboard is placed in an issue description. This MR covers one portion of that feature.

Feature: https://gitlab.com/gitlab-org/gitlab-ce/issues/30423

Context - the current dashboard flow:

  1. Frontend requests a dashboard from BE, which includes the layout of the page and the queries it should make (mostly just some yml). There are system dashboards and project-defined dashboards available. Endpoint: project/environments/env_id/metrics_dashboard
  2. Frontend requests prometheus data from internal proxy to prometheus endpoint, rendering the charts. Endpoint: /prometheus/api/v1/*proxy_path

Contents of this MR

Focuses on support for fetching metrics to embed. This is one part of the work for embedding metrics in GFM. The actual GFM portion of the work (which will indicate where metrics should be rendered in context) will be in a separate MR.

  • adds support for an embedded flag on the environments/id/metrics_dashboard endpoint
  • adds a service which generates and caches a dashboard specifically for embedding
  • Note that the embedded flag is behind the environment_metrics_show_multiple_dashboards feature flags

As there are no user-facing changes associated with this MR, a changelog will not be included.

Does this MR meet the acceptance criteria?

Conformity

Performance and testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Sarah Yasonik

Merge request reports