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

Fix Diagnostics performance log hint from HealthMonitor #25220

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,14 @@ private HealthMonitorLevel getHealthMonitorLevel() {
private final class HealthMonitorThread extends Thread {

private final int delaySeconds;
private boolean performanceLogHint;
private boolean showPerformanceLogHint;
JamesHazelcast marked this conversation as resolved.
Show resolved Hide resolved

private HealthMonitorThread(int delaySeconds) {
super(createThreadName(node.hazelcastInstance.getName(), "HealthMonitor"));
setDaemon(true);
this.delaySeconds = delaySeconds;
this.performanceLogHint = node.getProperties().getBoolean(Diagnostics.ENABLED);
// Show the hint if diagnostics are disabled; if already enabled, don't show it
this.showPerformanceLogHint = !node.getProperties().getBoolean(Diagnostics.ENABLED);
}

@Override
Expand Down Expand Up @@ -174,15 +175,15 @@ public void run() {
}

private void logDiagnosticsHint() {
if (!performanceLogHint) {
if (!showPerformanceLogHint) {
return;
}

// we only log the hint once
performanceLogHint = false;
showPerformanceLogHint = false;

logger.info(format("The HealthMonitor has detected a high load on the system. For more detailed information,%n"
+ "enable the Diagnostics by adding the property -D%s=true", Diagnostics.ENABLED));
+ "enable Diagnostics by adding the property -D%s=true", Diagnostics.ENABLED));
}
}

Expand Down