-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[improve][broker] Change log level to reduce duplicated logs #22147
Conversation
@mattisonchao Can you explain why this log is printed so many times? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, the file doesn't even seem to exist. Could we avoid the exception in the first place by checking with java.nio.file.Files#isReadable if the file exists and is readable? Does Files.isReadable check work for these special /sys/class/net
files?
@asafm Because the broker needs to report the load data constantly and then this judgement method will invoke many times. :) pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/LinuxInfoUtils.java Line 276 in 3b3c713
|
This method is only used to judge whether the current NIC is physical. IMO, the exception status also means not a valid physical NIC. I think giving it a debug-level log for troubleshooting is enough. And yes, we can give an extra operation to check if the current file type exists. but for the other exceptions, we still need to not print logs in the warn or error level to avoid annoying logs. cc @lhotari |
I think it's better to avoid exceptions and add a file existence check since we are touching this part of the code. |
Applied the comment. cc @lhotari |
c729249
to
1f95c3f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #22147 +/- ##
=============================================
- Coverage 73.57% 38.30% -35.27%
+ Complexity 32624 12168 -20456
=============================================
Files 1877 1737 -140
Lines 139502 132494 -7008
Branches 15299 14520 -779
=============================================
- Hits 102638 50757 -51881
- Misses 28908 74973 +46065
+ Partials 7956 6764 -1192
Flags with carried forward coverage won't be shown. Click here to find out more.
|
(cherry picked from commit c36c18d)
Motivation
Some vendors' environments do not support reading virtual NIC type. The broker will constantly print the useless warning log, which will increase the storage cost.
The demo logs is as follows:
Modifications
Verifying this change
Documentation
doc
doc-required
doc-not-needed
doc-complete