diff options
Diffstat (limited to 'lib/gitlab/sidekiq_logging/pause_control_logger.rb')
-rw-r--r-- | lib/gitlab/sidekiq_logging/pause_control_logger.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/gitlab/sidekiq_logging/pause_control_logger.rb b/lib/gitlab/sidekiq_logging/pause_control_logger.rb new file mode 100644 index 00000000000..d48b2b12f9d --- /dev/null +++ b/lib/gitlab/sidekiq_logging/pause_control_logger.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Gitlab + module SidekiqLogging + class PauseControlLogger + include Singleton + include LogsJobs + + def paused_log(job, strategy:) + payload = parse_job(job) + payload['job_status'] = 'paused' + payload['message'] = "#{base_message(payload)}: paused: #{strategy}" + payload['pause_control.strategy'] = strategy + + Sidekiq.logger.info payload + end + + def resumed_log(worker_name, args) + job = { + 'class' => worker_name, + 'args' => args + } + payload = parse_job(job) + payload['job_status'] = 'resumed' + payload['message'] = "#{base_message(payload)}: resumed" + + Sidekiq.logger.info payload + end + end + end +end |