Skip to content

Expose placeholder element for metrics charts in GFM

Sarah Yasonik requested to merge embedded-metrics-be-2 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

This is the GFM portion of the BE work for embedding metrics in issues. The work for filtering to just CPU/Memory charts can be found here: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/29696

  • Add a filter to GFM pipeline to insert a placeholder element for metrics charts
  • Redact the placeholder if the requesting user does not have permission to view the charts
  • Unit tests

The below item is pretty hard to test without FE up. Currently, the placeholder doesn't get copied, but that's also because nothing gets rendered. Will have to wait on this one or do it as part of the FE MR.

  • Add the HTML-to-GFM transformation to FE to support GFM export & copy-paste

This MR should contain no user-facing changes, and will correspondingly not have a changelog.

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