Skip to content

Add Metrics Dashboard embed pipeline to FF

Sarah Yasonik requested to merge sy-flag-metrics-dashboard-embeds into master

What does this MR do and why?

This MR gates the metrics dashboard embeds pipeline functionality behind the remove_monitor_metrics feature flag. Frontend is done, but we also want to deprecate/remove any API-only access.

Related issue: Metrics: Delete GFM pipeline logic for embeds (#397137 - closed), (one of many MRs)

Context for removal:

All related backend MRs to flag all metrics dashboard endpoints

How to set up and validate locally

** pre-req: project with an environment

operation how to test before after
Environment metrics embed

Pre-req: project with an environment

FactoryBot.create(:environment)
  1. generate the appropriate url

    Gitlab::Routing.url_helpers
      .metrics_dashboard_project_environment_url(
         Environment.last.project, 
         Environment.last, 
         embedded: true
      )
  2. Paste the url into a markdown field -> http://gdk.test:3000/namespace1/project-1/-/environments/1/metrics_dashboard?embedded=true

  3. Open dev tools & navigate to the Network tab

  4. Preview the markdown

Note: edit the markdown after swapping the flag to reset the cached version

The metrics-related error is because of the frontend finding the dashboard & attempting to retrieve data. But my local env doesn't actually have a prometheus server returning data, so we just get an error

Screenshot 2023-05-10 at 6.52.15 PM.png

There's no error because we're not including a placeholder embed for the frontend to latch onto

Screenshot 2023-05-10 at 6.50.50 PM.png

Cluster metrics embed

Pre-req: project with a cluster


```ruby
FactoryBot.create(:cluster, projects: [Environment.last.project], user: User.last)
```

\

1. Same as the previous one!

Gitlab::Routing.url_helpers
  .project_cluster_url(
    Environment.last.project, 
    Clusters::Cluster.last, 
    group: 'Group', 
    title: 'Title', 
    y_label: 'label'
)

Screenshot 2023-05-10 at 7.10.09 PM.png

Screenshot 2023-05-10 at 7.10.47 PM.png

Alert metrics embed

Pre-req: alert --> See !120307 (merged) for setup instructions

1. Same as previous.

Gitlab::Routing.url_helpers
  .metrics_dashboard_project_prometheus_alert_url(
    Environment.last.project, 
    AlertManagement::Alert.last
  )

Screenshot 2023-05-10 at 7.25.45 PM.png

Screenshot 2023-05-10 at 7.26.34 PM.png

Grafana metrics embed

Pre-req: grafana integration

FactoryBot.create(:grafana_integration, project: Environment.last.project)
  1. One more time!
 GrafanaIntegration.last.grafana_url + '/d/XDaNK6amz'

Screenshot 2023-05-10 at 7.31.30 PM.png

Screenshot 2023-05-10 at 7.32.03 PM.png

MR acceptance checklist

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

Edited by Sarah Yasonik

Merge request reports