2020-04-08 14:13:33 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module SidekiqLogging
|
|
|
|
class DeduplicationLogger
|
|
|
|
include Singleton
|
|
|
|
include LogsJobs
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
def 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
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|