Add embedding support to metrics_dashboard
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:
- 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
- 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 theenvironments/id/metrics_dashboard
endpoint - adds a service which generates and caches a dashboard specifically for embedding
- Note that the
embedded
flag is behind theenvironment_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
- [n/a] Changelog entry
- [n/a] Documentation created/updated or follow-up review issue created
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Performance and testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
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