Skip to content

Hide embedded metrics when removal flag is true

What does this MR do and why?

Describe in detail what your merge request does and why.

We are removing the Monitor Metrics and modules connected to it. This MR hides embedded metrics in flavoured markdown, when Metrics removal feature flag is set to true.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

before after
Screenshot_2023-05-05_at_09.22.28 Screenshot_2023-05-05_at_09.29.44

How to set up and validate locally

This setup is quite involved, so feel free to ping @tristan.read for a screen-share, or use the screenshots instead of testing manually.

Pre-requisites: Docker.

Create mock prometheus metrics:

  1. Check out https://gitlab.com/seanarnold/local-prometheus-metrics locally.
  2. Navigate to the local repo from step 1 and run docker-compose up.
  3. Note the prometheus URL (by default http://localhost:9090).
  4. Generate some data by navigating to the mock webserver a few times: http://localhost:8080/flakey

Connect prometheus to the GDK:

  1. Navigate to a project in the GDK.
  2. Navigate to Settings > Integrations > Prometheus.
  3. Input the prometheus URL from earlier and select 'Active'.
  4. Test and confirm a successful connection. Save the form.

Add an environment:

  1. Navigate to Deployments -> Environments (or Build -> Environments if the new sidebar is enabled).
  2. Select 'New environment' and create an environment called production.

Create the embed:

  1. Navigate to the metrics dashboard: Monitor -> Metrics.
  2. Scroll down to Response metrics (NGINX).
  3. Open the top-right menu of a chart and choose 'Copy link to Chart'
  4. Create a new issue and paste the copied embed link in the description. Save the issue.

You should see an embedded chart appear.

To test with the feature flag:

  1. Type this into terminal:
    rails c
    Feature.enable(:remove_monitor_metrics) 
  2. Refresh the issue.

You should no longer see an embedded chart.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #399231 (closed)

Edited by Tristan Read

Merge request reports