Skip to content

Add migration to import common metrics

What does this MR do?

Add a migration to import the new common metrics queries after they were updated to work with the pod/container labels as well as the older pod_name/container_name labels.

This migration won't change any table structure. It will import the Prometheus queries in the config/prometheus/common_metrics.yml file into the prometheus_metrics table.

This migration needs to be executed every time there is a change to the queries in config/prometheus/common_metrics.yml.

Up migration:

== 20200813153434 ImportLatestCommonMetrics: migrating ========================
== 20200813153434 ImportLatestCommonMetrics: migrated (0.0787s) ===============

Down migration:

== 20200813153434 ImportLatestCommonMetrics: reverting ========================
== 20200813153434 ImportLatestCommonMetrics: reverted (0.0000s) ===============

22 rows in prometheus_metrics table will be inserted/updated. The prometheus_metrics table on gitlab.com has ~908 rows.

This migration should take less than a second on gitlab.com since the number of rows being updated are very low.

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 Reuben Pereira

Merge request reports