Commit 95c60178 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'fix-structured-logger' into 'master'

Fix Structured Logger

See merge request gitlab-org/gitlab!60632
parents 450a22dd d2146775
...@@ -13,7 +13,7 @@ module EE ...@@ -13,7 +13,7 @@ module EE
super.call(chain) super.call(chain)
if load_balancing_enabled? if load_balancing_enabled?
chain.insert_after(::Labkit::Middleware::Sidekiq::Server, chain.insert_after(::Gitlab::SidekiqMiddleware::InstrumentationLogger,
::Gitlab::Database::LoadBalancing::SidekiqServerMiddleware) ::Gitlab::Database::LoadBalancing::SidekiqServerMiddleware)
end end
end end
......
...@@ -62,8 +62,8 @@ RSpec.describe Gitlab::SidekiqMiddleware do ...@@ -62,8 +62,8 @@ RSpec.describe Gitlab::SidekiqMiddleware do
::Gitlab::SidekiqMiddleware::ExtraDoneLogMetadata, ::Gitlab::SidekiqMiddleware::ExtraDoneLogMetadata,
::Gitlab::SidekiqMiddleware::BatchLoader, ::Gitlab::SidekiqMiddleware::BatchLoader,
::Labkit::Middleware::Sidekiq::Server, ::Labkit::Middleware::Sidekiq::Server,
::Gitlab::Database::LoadBalancing::SidekiqServerMiddleware,
::Gitlab::SidekiqMiddleware::InstrumentationLogger, ::Gitlab::SidekiqMiddleware::InstrumentationLogger,
::Gitlab::Database::LoadBalancing::SidekiqServerMiddleware,
::Gitlab::SidekiqMiddleware::AdminMode::Server, ::Gitlab::SidekiqMiddleware::AdminMode::Server,
::Gitlab::SidekiqVersioning::Middleware, ::Gitlab::SidekiqVersioning::Middleware,
::Gitlab::SidekiqStatus::ServerMiddleware, ::Gitlab::SidekiqStatus::ServerMiddleware,
......
...@@ -39,7 +39,7 @@ module Gitlab ...@@ -39,7 +39,7 @@ module Gitlab
private private
def add_instrumentation_keys!(job, output_payload) def add_instrumentation_keys!(job, output_payload)
output_payload.merge!(job[:instrumentation].stringify_keys) output_payload.merge!(job[:instrumentation].stringify_keys) if job[:instrumentation]
end end
def add_logging_extras!(job, output_payload) def add_logging_extras!(job, output_payload)
......
...@@ -293,6 +293,16 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do ...@@ -293,6 +293,16 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do
end end
end end
end end
context 'when instrumentation data is not loaded' do
before do
allow(logger).to receive(:info)
end
it 'does not raise exception' do
expect { subject.call(job.dup, 'test_queue') {} }.not_to raise_error
end
end
end end
describe '#add_time_keys!' do describe '#add_time_keys!' do
......
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