Improve unlock pipelines worker logging
As we were observing the logs for #415503 (closed), we realize we were lacking visibility on which specific pipelines were being unlocked in cases wherein the limited capacity worker would fail due to an exception.
This MR changes the logging order of pipeline ID and project, and also changes the Gitlab::SidekiqMiddleware::ExtraDoneLogMetadata to also log the logging_extras even on job failures due to errors.
How to test locally
- Make sure to enable the
ci_unlock_pipelines_queueandci_unlock_pipelinesflags. - On a sample project that generates an artifact, run a pipeline. This first pipeline will then be locked.
- Then before we run another pipeline, we want to temporarily force an error on the
Ci::UnlockPipelineService.-
def execute raise 'dummy error!' # Add this line unlock_pipeline_exclusively ... end
-
- Restart GDK and then run another pipeline so we can check the previous pipeline to be unlocked.
- Go to http://gdk.test:3000/admin/sidekiq/cron, and manually enqueue
ci_schedule_unlock_pipelines_in_queue_worker. - Observe
tail -f log/sidekiq.logand see the payload should includeextra.ci_unlock_pipelines_in_queue_worker.pipeline_idandextra.ci_unlock_pipelines_in_queue_worker.projectof the 1st pipeline that was supposed to be unlock.
Edited by Erick Bajao