Commit 5c030795 authored by Sean McGivern's avatar Sean McGivern Committed by Dylan Griffith

Omit previous error from Sidekiq JSON logs

Sidekiq stores a job's error details in the payload for the _next_ run,
so that it can display the error in the Sidekiq UI. This is because
Sidekiq's main state is the queue of jobs to be run. However, in our
logs, this is very confusing, because we shouldn't have any error at all
when a job starts, and we already add an error message and class to our
logs when a job fails.
parent e2fb96a9
---
title: Omit error details from previous attempt in Sidekiq JSON logs
merge_request: 25161
author:
type: changed
......@@ -77,7 +77,9 @@ module Gitlab
end
def parse_job(job)
job = job.dup
# 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')
# Add process id params
job['pid'] = ::Process.pid
......
......@@ -18,7 +18,10 @@ describe Gitlab::SidekiqLogging::StructuredLogger do
"jid" => "da883554ee4fe414012f5f42",
"created_at" => created_at.to_f,
"enqueued_at" => created_at.to_f,
"correlation_id" => 'cid'
"correlation_id" => 'cid',
"error_message" => "wrong number of arguments (2 for 3)",
"error_class" => "ArgumentError",
"error_backtrace" => []
}
end
......@@ -26,7 +29,7 @@ describe Gitlab::SidekiqLogging::StructuredLogger do
let(:clock_thread_cputime_start) { 0.222222299 }
let(:clock_thread_cputime_end) { 1.333333799 }
let(:start_payload) do
job.merge(
job.except('error_backtrace', 'error_class', 'error_message').merge(
'message' => 'TestWorker JID-da883554ee4fe414012f5f42: start',
'job_status' => 'start',
'pid' => Process.pid,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment