Commit 84d15ca3 authored by David Fernandez's avatar David Fernandez Committed by Jan Provaznik

Enqueuer job: add container repository migration state logging

parent 47a44824
......@@ -41,6 +41,8 @@ module ContainerRegistry
Gitlab::ErrorTracking.log_exception(e, next_aborted_repository_id: next_aborted_repository&.id)
true
ensure
log_repository_migration_state(next_aborted_repository)
end
def handle_next_migration
......@@ -59,6 +61,8 @@ module ContainerRegistry
next_repository&.abort_import
false
ensure
log_repository_migration_state(next_repository)
end
def tag_count_too_high?
......@@ -151,6 +155,12 @@ module ContainerRegistry
log_extra_metadata_on_done(:container_repository_path, repository&.path)
end
def log_repository_migration_state(repository)
return unless repository
log_extra_metadata_on_done(:container_repository_migration_state, repository.migration_state)
end
# used by ExclusiveLeaseGuard
def lease_key
'container_registry:migration:enqueuer_worker'
......
......@@ -64,7 +64,8 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
expect_log_extra_metadata(
import_type: 'next',
container_repository_id: container_repository.id,
container_repository_path: container_repository.path
container_repository_path: container_repository.path,
container_repository_migration_state: 'pre_importing'
)
subject
......@@ -135,7 +136,8 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
expect_log_extra_metadata(
import_type: 'retry',
container_repository_id: aborted_repository.id,
container_repository_path: aborted_repository.path
container_repository_path: aborted_repository.path,
container_repository_migration_state: 'importing'
)
subject
......@@ -158,7 +160,8 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
expect_log_extra_metadata(
import_type: 'retry',
container_repository_id: aborted_repository.id,
container_repository_path: aborted_repository.path
container_repository_path: aborted_repository.path,
container_repository_migration_state: 'import_aborted'
)
subject
......@@ -189,6 +192,7 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
import_type: 'next',
container_repository_id: container_repository.id,
container_repository_path: container_repository.path,
container_repository_migration_state: 'import_skipped',
tags_count_too_high: true,
max_tags_count_setting: 2
)
......@@ -212,7 +216,8 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
expect_log_extra_metadata(
import_type: 'next',
container_repository_id: container_repository.id,
container_repository_path: container_repository.path
container_repository_path: container_repository.path,
container_repository_migration_state: 'import_aborted'
)
expect(Gitlab::ErrorTracking).to receive(:log_exception).with(
......
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