Skip to content

Fix Gitlab::Geo::LogHelpers exceptions

What does this MR do and why?

Same as !113031 (merged), this MR removes the usage of the type, and shard keys in logs. These exceptions were found while working on !110675 (merged).

Screenshots or screen recordings

  1) Geo::RepositoryVerificationPrimaryService#perform when checksum calculation fails keeps track of failures
     Failure/Error: build.error(message)

     RuntimeError:
       The following log keys used are reserved: type

       Use key names that are descriptive e.g. by using a prefix.
     # ./lib/gitlab/json_logger.rb:20:in `error'
     # ./ee/lib/gitlab/geo/log_helpers.rb:18:in `log_error'
     # ./ee/app/services/geo/repository_verification_primary_service.rb:24:in `rescue in verify_checksum'
     # ./ee/app/services/geo/repository_verification_primary_service.rb:20:in `verify_checksum'
     # ./ee/app/services/geo/repository_verification_primary_service.rb:10:in `execute'
     # ./ee/spec/services/geo/repository_verification_primary_service_spec.rb:174:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:506:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:498:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:494:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:59:in `with_raw_context'
     # ./spec/spec_helper.rb:494:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:242:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:108:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:108:in `block (2 levels) in <main>'
     # ------------------
     # --- Caused by: ---
     # RuntimeError:
     #   Something went wrong with repository
     #   ./ee/app/services/geo/base_repository_verification_service.rb:15:in `calculate_checksum'
  1) Geo::RepositoryShardSyncWorker#perform does not perform Geo::ProjectSyncWorker when no geo database is configured
     Failure/Error: build.info(message)

     RuntimeError:
       The following log keys used are reserved: shard

       Use key names that are descriptive e.g. by using a prefix.
     # ./lib/gitlab/json_logger.rb:28:in `info'
     # ./ee/lib/gitlab/geo/log_helpers.rb:11:in `log_info'
     # ./ee/app/workers/geo/scheduler/secondary/scheduler_worker.rb:9:in `perform'
     # ./ee/app/workers/geo/repository_shard_sync_worker.rb:18:in `perform'
     # ./ee/spec/workers/geo/repository_shard_sync_worker_spec.rb:41:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:506:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:498:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:494:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:59:in `with_raw_context'
     # ./spec/spec_helper.rb:494:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:242:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/redis.rb:17:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:108:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:108:in `block (2 levels) in <main>'
     # ./ee/spec/support/caching.rb:6:in `block (3 levels) in <main>'
     # ./ee/spec/support/caching.rb:5:in `block (2 levels) in <main>'

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Realated isues

#393299 (closed)

Edited by Douglas Barbosa Alexandre

Merge request reports