Commit 1fc783a6 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch 'bvl-log-job-size-on-start' into 'master'

Add the job size to start message logging

See merge request gitlab-org/gitlab!53248
parents d7ffc806 d313f8d7
......@@ -13,7 +13,7 @@ module Gitlab
base_payload = parse_job(job)
ActiveRecord::LogSubscriber.reset_runtime
Sidekiq.logger.info log_job_start(base_payload)
Sidekiq.logger.info log_job_start(job, base_payload)
yield
......@@ -40,13 +40,15 @@ module Gitlab
output_payload.merge!(job.slice(*::Gitlab::Metrics::Subscribers::ActiveRecord::DB_COUNTERS))
end
def log_job_start(payload)
def log_job_start(job, payload)
payload['message'] = "#{base_message(payload)}: start"
payload['job_status'] = 'start'
scheduling_latency_s = ::Gitlab::InstrumentationHelper.queue_duration_for_job(payload)
payload['scheduling_latency_s'] = scheduling_latency_s if scheduling_latency_s
payload['job_size_bytes'] = Sidekiq.dump_json(job).bytesize
payload
end
......
......@@ -38,7 +38,8 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do
'pid' => Process.pid,
'created_at' => created_at.to_f,
'enqueued_at' => created_at.to_f,
'scheduling_latency_s' => scheduling_latency_s
'scheduling_latency_s' => scheduling_latency_s,
'job_size_bytes' => be > 0
)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment