Commit d368c4f4 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '356999-log-container-repository-migration-state' into 'master'

Enqueuer job: add container repository migration state logging

See merge request gitlab-org/gitlab!83861
parents 58d7b33a 84d15ca3
...@@ -41,6 +41,8 @@ module ContainerRegistry ...@@ -41,6 +41,8 @@ module ContainerRegistry
Gitlab::ErrorTracking.log_exception(e, next_aborted_repository_id: next_aborted_repository&.id) Gitlab::ErrorTracking.log_exception(e, next_aborted_repository_id: next_aborted_repository&.id)
true true
ensure
log_repository_migration_state(next_aborted_repository)
end end
def handle_next_migration def handle_next_migration
...@@ -59,6 +61,8 @@ module ContainerRegistry ...@@ -59,6 +61,8 @@ module ContainerRegistry
next_repository&.abort_import next_repository&.abort_import
false false
ensure
log_repository_migration_state(next_repository)
end end
def tag_count_too_high? def tag_count_too_high?
...@@ -151,6 +155,12 @@ module ContainerRegistry ...@@ -151,6 +155,12 @@ module ContainerRegistry
log_extra_metadata_on_done(:container_repository_path, repository&.path) log_extra_metadata_on_done(:container_repository_path, repository&.path)
end 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 # used by ExclusiveLeaseGuard
def lease_key def lease_key
'container_registry:migration:enqueuer_worker' 'container_registry:migration:enqueuer_worker'
......
...@@ -64,7 +64,8 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures ...@@ -64,7 +64,8 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
expect_log_extra_metadata( expect_log_extra_metadata(
import_type: 'next', import_type: 'next',
container_repository_id: container_repository.id, 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 subject
...@@ -135,7 +136,8 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures ...@@ -135,7 +136,8 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
expect_log_extra_metadata( expect_log_extra_metadata(
import_type: 'retry', import_type: 'retry',
container_repository_id: aborted_repository.id, container_repository_id: aborted_repository.id,
container_repository_path: aborted_repository.path container_repository_path: aborted_repository.path,
container_repository_migration_state: 'importing'
) )
subject subject
...@@ -158,7 +160,8 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures ...@@ -158,7 +160,8 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
expect_log_extra_metadata( expect_log_extra_metadata(
import_type: 'retry', import_type: 'retry',
container_repository_id: aborted_repository.id, 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 subject
...@@ -189,6 +192,7 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures ...@@ -189,6 +192,7 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
import_type: 'next', import_type: 'next',
container_repository_id: container_repository.id, container_repository_id: container_repository.id,
container_repository_path: container_repository.path, container_repository_path: container_repository.path,
container_repository_migration_state: 'import_skipped',
tags_count_too_high: true, tags_count_too_high: true,
max_tags_count_setting: 2 max_tags_count_setting: 2
) )
...@@ -212,7 +216,8 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures ...@@ -212,7 +216,8 @@ RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures
expect_log_extra_metadata( expect_log_extra_metadata(
import_type: 'next', import_type: 'next',
container_repository_id: container_repository.id, 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( 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