Class: Gitlab::SidekiqLogging::DeduplicationLogger

Inherits:
Object
  • Object
show all
Includes:
LogsJobs, Singleton
Defined in:
lib/gitlab/sidekiq_logging/deduplication_logger.rb

Instance Method Summary collapse

Methods included from LogsJobs

#base_message, #parse_job

Instance Method Details

#log(job, deduplication_type, deduplication_options = {}) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/gitlab/sidekiq_logging/deduplication_logger.rb', line 9

def log(job, deduplication_type, deduplication_options = {})
  payload = parse_job(job)
  payload['job_status'] = 'deduplicated'
  payload['message'] = "#{base_message(payload)}: deduplicated: #{deduplication_type}"
  payload['deduplication.type'] = deduplication_type
  # removing nil values from deduplication options
  payload.merge!(
    deduplication_options.compact.transform_keys { |k| "deduplication.options.#{k}" })

  Sidekiq.logger.info payload
end