Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stopped logging warnings for large queue payload #5393

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/miq_queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def warn_if_large_payload
args_size = args ? YAML.dump(args).length : 0
data_size = data ? data.length : 0

if (args_size + data_size) > 512
if (args_size + data_size) > 10240
culprit = caller.detect { |r| ! (r =~ /miq_queue.rb/) } || ""
_log.warn("#{culprit.split(":in ").first} called with large payload (args: #{args_size} bytes, data: #{data_size} bytes) #{MiqQueue.format_full_log_msg(self)}")
end
Expand All @@ -121,7 +121,7 @@ def self.put(options)
options[:args] = [options[:args]] if options[:args] && !options[:args].kind_of?(Array)

msg = MiqQueue.create!(options)
msg.warn_if_large_payload
msg.warn_if_large_payload unless Rails.env.production?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be honest, I think this is only significant in production.
@Fryguy do you remember the back story on this warning?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I don't understand why we need to pay the penalty of yaml dump and potentially logging in every queue put. Even if we have the yaml string, let's figure out what this log message solves. Do we really care about the size or do we really care how long it takes to create or something else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See ☝️ #5393 (comment)

_log.info("#{MiqQueue.format_full_log_msg(msg)}")
msg
end
Expand Down
2 changes: 1 addition & 1 deletion spec/models/miq_queue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ def self.some_method(single_arg)
EvmSpecHelper.create_guid_miq_server_zone

$log.should_receive(:warn).with(/miq_queue_spec.rb.*large payload/)
MiqQueue.put(:class_name => 'MyClass', :method_name => 'method1', :data => 'a' * 600)
MiqQueue.put(:class_name => 'MyClass', :method_name => 'method1', :data => 'a' * 10600)
end

it "should not warn if the data size is small" do
Expand Down