Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20200813153434_import_latest_common_metrics.rb')
-rw-r--r--db/post_migrate/20200813153434_import_latest_common_metrics.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/db/post_migrate/20200813153434_import_latest_common_metrics.rb b/db/post_migrate/20200813153434_import_latest_common_metrics.rb
new file mode 100644
index 00000000000..203e495674f
--- /dev/null
+++ b/db/post_migrate/20200813153434_import_latest_common_metrics.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class ImportLatestCommonMetrics < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ # The common_metrics queries were updated to work with K8s versions that
+ # use the pod/container label names as well as K8s versions that use the
+ # older pod_name/container_name convention.
+ ::Gitlab::DatabaseImporters::CommonMetrics::Importer.new.execute
+ end
+
+ def down
+ # no-op
+ # The import cannot be reversed since we do not know the state that the
+ # common metrics in the PrometheusMetric table were in before the import.
+
+ # To manually revert this migration.
+ # 1. Go back to the previous version of the config/prometheus/common_metrics.yml file. (git checkout 74447f11349617ed8b273196d6a5781d9a67a613)
+ # 2. Execute `rails runner '::Gitlab::DatabaseImporters::CommonMetrics::Importer.new.execute'`
+ end
+end