2020-03-09 14:07:59 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module SidekiqLogging
|
|
|
|
class DeduplicationLogger
|
|
|
|
include Singleton
|
|
|
|
include LogsJobs
|
|
|
|
|
2021-10-22 11:19:11 -04:00
|
|
|
def deduplicated_log(job, deduplication_type, deduplication_options = {})
|
2020-03-09 14:07:59 -04:00
|
|
|
payload = parse_job(job)
|
|
|
|
payload['job_status'] = 'deduplicated'
|
|
|
|
payload['message'] = "#{base_message(payload)}: deduplicated: #{deduplication_type}"
|
2020-07-16 14:09:35 -04:00
|
|
|
payload['deduplication.type'] = deduplication_type
|
|
|
|
# removing nil values from deduplication options
|
|
|
|
payload.merge!(
|
|
|
|
deduplication_options.compact.transform_keys { |k| "deduplication.options.#{k}" })
|
2020-03-09 14:07:59 -04:00
|
|
|
|
|
|
|
Sidekiq.logger.info payload
|
|
|
|
end
|
2021-10-22 11:19:11 -04:00
|
|
|
|
|
|
|
def rescheduled_log(job)
|
|
|
|
payload = parse_job(job)
|
|
|
|
payload['job_status'] = 'rescheduled'
|
|
|
|
payload['message'] = "#{base_message(payload)}: rescheduled"
|
|
|
|
|
|
|
|
Sidekiq.logger.info payload
|
|
|
|
end
|
2020-03-09 14:07:59 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|