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

27 lines
760 B
Ruby
Raw Normal View History

2020-04-08 14:13:33 +05:30
# frozen_string_literal: true
module Gitlab
module SidekiqLogging
module LogsJobs
def base_message(payload)
"#{payload['class']} JID-#{payload['jid']}"
end
2020-04-22 19:07:51 +05:30
# NOTE: Arguments are truncated/stringified in sidekiq_logging/json_formatter.rb
2020-04-08 14:13:33 +05:30
def parse_job(job)
# Error information from the previous try is in the payload for
# displaying in the Sidekiq UI, but is very confusing in logs!
job = job.except('error_backtrace', 'error_class', 'error_message')
2021-03-11 19:13:27 +05:30
job['class'] = job.delete('wrapped') if job['wrapped'].present?
2020-04-08 14:13:33 +05:30
# Add process id params
job['pid'] = ::Process.pid
2021-01-29 00:20:46 +05:30
job.delete('args') unless SidekiqLogArguments.enabled?
2020-04-08 14:13:33 +05:30
job
end
end
end
end