Skip to content

Move metrics controller EE methods into Core

Reuben Pereira requested to merge 42639-move-custom-metrics-controller into master

What does this MR do?

Issue: #42639 (closed)

This MR moves the EE metrics controller code into the core metrics controller.

This is the third MR in a chain of MRs.

Changes in this MR:

  1. Move ee/app/controllers/ee/projects/prometheus/metrics_controller.rb into app/controllers/projects/prometheus/metrics_controller.rb.
  2. Move ee/spec/controllers/projects/prometheus/metrics_controller_spec.rb into spec/controllers/projects/prometheus/metrics_controller_spec.rb.
  3. Move validate_query route from ee/config/routes/project.rb into config/routes/project.rb since validate_query is one of the controller endpoints being moved.
  4. Move ee/spec/fixtures/api/schemas/prometheus/metrics.json to spec/fixtures/api/schemas/prometheus/metrics.json since it is used by the prometheus_metrics_controller_spec.rb file.
  5. Move ee/lib/gitlab/prometheus/queries/validate_query.rb to lib/gitlab/prometheus/queries/validate_query.rb.
  6. Move ee/app/serializers/prometheus_metric_serializer.rb to app/serializers/prometheus_metric_serializer.rb since it is only used by the MetricsController.
  7. Move ee/app/serializers/prometheus_metric_entity.rb to app/serializers/prometheus_metric_entity.rb since it is only used by the PrometheusMetricSerializer.
  8. Move ee/app/views/projects/prometheus/metrics/edit.html.haml to app/views/projects/prometheus/metrics/edit.html.haml since it is used by the MetricsController#edit endpoint.
  9. Move ee/app/views/projects/prometheus/metrics/new.html.haml to app/views/projects/prometheus/metrics/new.html.haml since it is used by the MetricsController#new endpoint.
  10. Move ee/app/views/projects/prometheus/metrics/_form.html.haml to app/views/projects/prometheus/metrics/_form.html.haml since the view is used by the new and edit HTML files.

Manual testing

To test the EE product, follow the steps in the issue to test create/edit/delete a custom metric.

To test the CE product, remove the ee folder (you can rename it instead) of your GDK and verify that the Prometheus integration settings page (Settings > Integrations > Prometheus) works fine. The custom metrics feature will not show up in CE until the frontend MR is merged.

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