Add the job size to start message logging

What does this MR do?

This would allow us to see how big jobs are in the log, perhaps allowing us to set a sensible limit.

The size gets calculated to log in the start message, which will also make it available in the done message.

This is triggered by gitlab-com/gl-infra/scalability#825

Screenshots (strongly suggested)

2021-02-03_15:07:22.02279 rails-background-jobs : {"severity":"INFO","time":"2021-02-03T15:07:22.022Z","queue":"cronjob:geo_sidekiq_cron_config","args":[],"class":"Geo::SidekiqCronConfigWorker","retry":0,"backtrace":true,"version":0,"queue_namespace":"cronjob","jid":"18ae604606589915c46cf449","created_at":"2021-02-03T15:07:20.460Z","meta.caller_id":"Cronjob","correlation_id":"fd398b879a658261a1d66546f81cb154","uber-trace-id":"d3bcfadcf8867b6e:d3bcfadcf8867b6e:0:1","enqueued_at":"2021-02-03T15:07:20.462Z","pid":9411,"message":"Geo::SidekiqCronConfigWorker JID-18ae604606589915c46cf449: done: 1.556568 sec","job_status":"done","scheduling_latency_s":0.003492,"job_size_bytes":395,"db_count":0,"db_write_count":0,"db_cached_count":0,"duration_s":1.556568,"cpu_s":0.387845,"completed_at":"2021-02-03T15:07:22.022Z","db_duration_s":0.011818}
2021-02-03_15:07:22.03309 rails-background-jobs : {"severity":"INFO","time":"2021-02-03T15:07:22.032Z","queue":"cronjob:schedule_merge_request_cleanup_refs","args":[],"class":"ScheduleMergeRequestCleanupRefsWorker","retry":0,"backtrace":true,"version":0,"queue_namespace":"cronjob","jid":"aec741c7f090ab272a528225","created_at":"2021-02-03T15:07:20.348Z","meta.caller_id":"Cronjob","correlation_id":"2439792b80e8e30c573fcfe3ade692e4","uber-trace-id":"81c02e57ef93738a:81c02e57ef93738a:0:1","enqueued_at":"2021-02-03T15:07:20.350Z","pid":9411,"message":"ScheduleMergeRequestCleanupRefsWorker JID-aec741c7f090ab272a528225: done: 1.680147 sec","job_status":"done","scheduling_latency_s":0.002115,"job_size_bytes":416,"db_count":1,"db_write_count":0,"db_cached_count":0,"duration_s":1.680147,"cpu_s":0.328562,"completed_at":"2021-02-03T15:07:22.032Z","db_duration_s":0.014764}

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Bob Van Landuyt

Merge request reports

Loading