Commit 6aeaf9ef authored by Stan Hu's avatar Stan Hu

Simplify class field when logging bulk arguments

In https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73223/diffs, we
were previously logging a Hash of elements for `class` when we really
just needed the class name. The mismatched types was causing
Elasticsearch to drop these log messages.
parent c547531d
......@@ -145,12 +145,12 @@ module ApplicationWorker
def bulk_perform_async(args_list)
if log_bulk_perform_async?
Sidekiq.logger.info('class' => self, 'args_list' => args_list, 'args_list_count' => args_list.length, 'message' => 'Inserting multiple jobs')
Sidekiq.logger.info('class' => self.name, 'args_list' => args_list, 'args_list_count' => args_list.length, 'message' => 'Inserting multiple jobs')
end
do_push_bulk(args_list).tap do |job_ids|
if log_bulk_perform_async?
Sidekiq.logger.info('class' => self, 'jid_list' => job_ids, 'jid_list_count' => job_ids.length, 'message' => 'Completed JID insertion')
Sidekiq.logger.info('class' => self.name, 'jid_list' => job_ids, 'jid_list_count' => job_ids.length, 'message' => 'Completed JID insertion')
end
end
end
......
......@@ -355,9 +355,9 @@ RSpec.describe ApplicationWorker do
worker.log_bulk_perform_async!
expect(Sidekiq.logger).to(
receive(:info).with(hash_including('args_list' => args)).once.and_call_original)
receive(:info).with(hash_including('class' => worker.name, 'args_list' => args)).once.and_call_original)
expect(Sidekiq.logger).to(
receive(:info).with(hash_including('jid_list' => anything)).once.and_call_original)
receive(:info).with(hash_including('class' => worker.name, 'jid_list' => anything)).once.and_call_original)
perform_action
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