Commit 8964044d authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'omit-previous-error-from-sidekiq-logs' into 'master'

Omit previous error from Sidekiq JSON logs

See merge request gitlab-org/gitlab!25161
parents e2fb96a9 5c030795
---
title: Omit error details from previous attempt in Sidekiq JSON logs
merge_request: 25161
author:
type: changed
...@@ -77,7 +77,9 @@ module Gitlab ...@@ -77,7 +77,9 @@ module Gitlab
end end
def parse_job(job) 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 # Add process id params
job['pid'] = ::Process.pid job['pid'] = ::Process.pid
......
...@@ -18,7 +18,10 @@ describe Gitlab::SidekiqLogging::StructuredLogger do ...@@ -18,7 +18,10 @@ describe Gitlab::SidekiqLogging::StructuredLogger do
"jid" => "da883554ee4fe414012f5f42", "jid" => "da883554ee4fe414012f5f42",
"created_at" => created_at.to_f, "created_at" => created_at.to_f,
"enqueued_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 end
...@@ -26,7 +29,7 @@ describe Gitlab::SidekiqLogging::StructuredLogger do ...@@ -26,7 +29,7 @@ describe Gitlab::SidekiqLogging::StructuredLogger do
let(:clock_thread_cputime_start) { 0.222222299 } let(:clock_thread_cputime_start) { 0.222222299 }
let(:clock_thread_cputime_end) { 1.333333799 } let(:clock_thread_cputime_end) { 1.333333799 }
let(:start_payload) do let(:start_payload) do
job.merge( job.except('error_backtrace', 'error_class', 'error_message').merge(
'message' => 'TestWorker JID-da883554ee4fe414012f5f42: start', 'message' => 'TestWorker JID-da883554ee4fe414012f5f42: start',
'job_status' => 'start', 'job_status' => 'start',
'pid' => Process.pid, '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