Log extra metadata sidekiq done for ElasticIndexBulkCronWorker
This introduces a generic worker capability `ApplicationWorker#log_extra_metadata_on_done(key, value)` to add metadata that will later be logged with the done job payload. When called this method will add the key/value to a `Hash` which is then pushed all the way up the middleware to the `StructuredLogger` and amended to the done log statement. This MR also uses this functionality in ElasticIndexBulkCronWorker. This is an improved way of doing the same thing as was implemented in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/30265 which allows easily correlating the duration of a job with the size of the job being processed. This is better because sidekiq done logs are already broken out in detail for DB time, CPU time, Redis time and so we'd prefer to build on that existing behaviour when doing our analysis.
Showing
Please register or sign in to comment