• Dylan Griffith's avatar
    Log extra metadata sidekiq done for ElasticIndexBulkCronWorker · 5c31b6b6
    Dylan Griffith authored
    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.
    5c31b6b6
structured_logger.rb 3.2 KB