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

20200813153434_import_latest_common_metrics.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 203e495674f0d54c7b1d5d6735f88f56b1dddcf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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