Class: Gitlab::BackgroundMigration::FixProjectsWithoutPrometheusService

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/background_migration/fix_projects_without_prometheus_service.rb

Overview

This migration creates missing services records for the projects within the given range of ids

Defined Under Namespace

Modules: Migratable

Constant Summary collapse

MAX_BATCH_SIZE =

There is important inconsistency between single query timeout 15s and background migration worker minimum lease 2 minutes to address that scheduled ids range (for minimum 2 minutes processing) should be inserted in smaller portions to fit under 15s limit. gitlab.com/gitlab-com/gl-infra/infrastructure/issues/9064#note_279857215

1_000
DEFAULTS =
{
  'active' => true,
  'properties' => "'{}'",
  'type' => "'PrometheusService'",
  'template' => false,
  'push_events' => true,
  'issues_events' => true,
  'merge_requests_events' => true,
  'tag_push_events' => true,
  'note_events' => true,
  'category' => "'monitoring'",
  'default' => false,
  'wiki_page_events' => true,
  'pipeline_events' => true,
  'confidential_issues_events' => true,
  'commit_events' => true,
  'job_events' => true,
  'confidential_note_events' => true
}.freeze

Instance Method Summary collapse

Instance Method Details

#perform(from_id, to_id) ⇒ Object



109
110
111
112
113
# File 'lib/gitlab/background_migration/fix_projects_without_prometheus_service.rb', line 109

def perform(from_id, to_id)
  (from_id..to_id).each_slice(MAX_BATCH_SIZE) do |batch|
    process_batch(batch.first, batch.last)
  end
end