Commit 96110427 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'fix-sidekiq-error-processor-outside-a-job' into 'master'

Fix Sidekiq reporting to Sentry outside of job contexts

See merge request gitlab-org/gitlab!77659
parents c11f8b46 4ee15af6
...@@ -53,6 +53,8 @@ module Gitlab ...@@ -53,6 +53,8 @@ module Gitlab
# 'args' in :job => from default error handler # 'args' in :job => from default error handler
job_holder = sidekiq.key?('args') ? sidekiq : sidekiq[:job] job_holder = sidekiq.key?('args') ? sidekiq : sidekiq[:job]
return event unless job_holder
if job_holder['args'] if job_holder['args']
job_holder['args'] = filter_arguments(job_holder['args'], job_holder['class']).to_a job_holder['args'] = filter_arguments(job_holder['args'], job_holder['class']).to_a
end end
......
...@@ -178,5 +178,14 @@ RSpec.describe Gitlab::ErrorTracking::Processor::SidekiqProcessor do ...@@ -178,5 +178,14 @@ RSpec.describe Gitlab::ErrorTracking::Processor::SidekiqProcessor do
expect(result_hash.dig(:extra, :sidekiq)).to be_nil expect(result_hash.dig(:extra, :sidekiq)).to be_nil
end end
end end
context 'when there is Sidekiq data but no job' do
let(:value) { { other: 'foo' } }
let(:wrapped_value) { { extra: { sidekiq: value } } }
it 'does nothing' do
expect(result_hash.dig(:extra, :sidekiq)).to eq(value)
end
end
end end
end end
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