Giriş
Şu satırı dahil ederiz
import com.hazelcast.internal.diagnostics.HealthMonitor;
MetricsRegistry sınıfından bir sürü şeyi okuyarak periyodik olarak loglar.
run metodu
Kod şöyle
@Override
public void run() {
try {
while (node.getState() == NodeState.ACTIVE) {
healthMetrics.update();
switch (monitorLevel) {
case NOISY:
if (healthMetrics.exceedsThreshold()) {
logDiagnosticsHint();
}
logger.info(healthMetrics.render());
break;
case SILENT:
if (healthMetrics.exceedsThreshold()) {
logDiagnosticsHint();
logger.info(healthMetrics.render());
}
break;
default:
throw new
IllegalStateException("Unrecognized HealthMonitorLevel: " + monitorLevel);
}
try {
SECONDS.sleep(delaySeconds);
} catch (InterruptedException e) {
currentThread().interrupt();
return;
}
}
} catch (OutOfMemoryError e) {
OutOfMemoryErrorDispatcher.onOutOfMemory(e);
} catch (Throwable t) {
logger.warning("Health Monitor failed", t);
}
}Eğer SILENT ise açıklaması şöyle
These logs are triggered when certain performance indicators exceed a threshold.
Hiç yorum yok:
Yorum Gönder