debian-mirror-gitlab/lib/gitlab/sidekiq_logging/deduplication_logger.rb

31 lines
925 B
Ruby
Raw Normal View History

2020-04-08 14:13:33 +05:30
# frozen_string_literal: true
module Gitlab
module SidekiqLogging
class DeduplicationLogger
include Singleton
include LogsJobs
2021-12-11 22:18:48 +05:30
def deduplicated_log(job, deduplication_type, deduplication_options = {})
2020-04-08 14:13:33 +05:30
payload = parse_job(job)
payload['job_status'] = 'deduplicated'
payload['message'] = "#{base_message(payload)}: deduplicated: #{deduplication_type}"
2020-07-28 23:09:34 +05:30
payload['deduplication.type'] = deduplication_type
# removing nil values from deduplication options
payload.merge!(
deduplication_options.compact.transform_keys { |k| "deduplication.options.#{k}" })
2020-04-08 14:13:33 +05:30
Sidekiq.logger.info payload
end
2021-12-11 22:18:48 +05:30
def rescheduled_log(job)
payload = parse_job(job)
payload['job_status'] = 'rescheduled'
payload['message'] = "#{base_message(payload)}: rescheduled"
Sidekiq.logger.info payload
end
2020-04-08 14:13:33 +05:30
end
end
end