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
Fix Diagnostics performance log hint from HealthMonitor #25220
Fix Diagnostics performance log hint from HealthMonitor #25220
Conversation
It appears the log hint boolean check is inverted - currently the hint is only shown if diagnostics are already enabled; it should be the other way around.
hazelcast/src/main/java/com/hazelcast/internal/diagnostics/HealthMonitor.java
Show resolved
Hide resolved
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.
That seems confusing.
Small nitpick: maybe add test case to verify the log is presented only once when the initial state is false
for hazelcast.diagnostics.enabled
?
I'm not crazy about testing logging output. So I would not go for adding such a test. |
Me too; but not on the output: the invocation given that the negation in multiple points made the data flow so confusing. Would have helped any future refactoring. |
I agree a test would be nice - it would’ve avoided this defect - but you’d need to decouple the check from the actual logger to assert the behaviour. And that’s quite a lot of overhead. |
And you need to be able to control the logger which isn't always possible (or desirable) because it can make the code a lot more complex and that often isn't worth it. |
Indeed, depends on context. The only thing that (and as I noted it was a 'minor nitpick') adding a test would do is clarify the side effect of the entirely confusing boolean logic. |
It appears the log hint boolean check is inverted - currently the hint is only shown if diagnostics are already enabled; it should be the other way around.