Commit e244c13d authored by rpereira2's avatar rpereira2

Add migration to import common metrics

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.
parent 78dc6025
---
title: Import the new queries in common_metrics.yml into database
merge_request: 39475
author:
type: changed
# 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
23de9421726337f5279bf434542bffda24cbadc7324b498ff642ec4c0883b5d5
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment