Browse Source

Reduce DEBUG log noise from LocalHealthMonitor (#92933)

There's no need to log `DEBUG` messages on every cluster state update
here. Dropping ones that happen every time to `TRACE`.

Also gives `HealthMetadata` a proper `toString()` implementation since
it appears in the output of `ClusterState#toString`
David Turner 2 years ago
parent
commit
6ec31ed153

+ 6 - 0
server/src/main/java/org/elasticsearch/health/metadata/HealthMetadata.java

@@ -12,6 +12,7 @@ import org.elasticsearch.Version;
 import org.elasticsearch.cluster.AbstractNamedDiffable;
 import org.elasticsearch.cluster.ClusterState;
 import org.elasticsearch.cluster.NamedDiff;
+import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.collect.Iterators;
 import org.elasticsearch.common.io.stream.StreamInput;
 import org.elasticsearch.common.io.stream.StreamOutput;
@@ -96,6 +97,11 @@ public final class HealthMetadata extends AbstractNamedDiffable<ClusterState.Cus
         return Objects.hash(diskMetadata);
     }
 
+    @Override
+    public String toString() {
+        return "HealthMetadata{diskMetadata=" + Strings.toString(diskMetadata) + '}';
+    }
+
     /**
      * Contains the thresholds necessary to determine the health of the disk space of a node. The thresholds are determined by the elected
      * master.

+ 1 - 1
server/src/main/java/org/elasticsearch/health/node/LocalHealthMonitor.java

@@ -160,7 +160,7 @@ public class LocalHealthMonitor implements ClusterStateListener {
                 );
                 logger.debug("Local health monitoring started {}", monitoring);
             } else {
-                logger.debug("Local health monitoring already started {}, skipping", monitoring);
+                logger.trace("Local health monitoring already started {}, skipping", monitoring);
             }
         }
     }