Skip to content

Refactor predefined dashboard services

Reuben Pereira requested to merge refactor-predefined-dashboard-services into master

What does this MR do?

We currently have two predefined dashboards: config/prometheus/common_metrics.yml and config/prometheus/cluster_metrics.yml. These dashboards are processed by Metrics::Dashboard::SystemDashboardService and Metrics::Dashboard::ClusterDashboardService respectively. These services have a lot in common. In preparation for adding another predefined dashboard in !20242 (merged), move out common code into a Metrics::Dashboard::PredefinedDashboardService that SystemDashboardService, ClusterDashboardService and future predefined dashboard services can inherit from.

Changes that this MR contains:

  1. Move common code from Metrics::Dashboard::SystemDashboardService and Metrics::Dashboard::ClusterDashboardService into a new class Metrics::Dashboard::PredefinedDashboardService.

  2. Rename the SYSTEM_DASHBOARD_PATH and SYSTEM_DASHBOARD_NAME constants to be DASHBOARD_PATH and DASHBOARD_NAME instead.

  3. Move spec caches the unprocessed dashboard for subsequent calls into MetricsDashboardHelpers so that it can be reused in all dashboard service specs.

Issue: #35242 (closed)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability 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 🤖 GitLab Bot 🤖

Merge request reports

Loading