Skip to content

Commit 483ba7f

Browse files
committed
Add additional logging to make spotting stats issues easier
1 parent 7304197 commit 483ba7f

File tree

1 file changed

+8
-0
lines changed
  • server/src/main/java/org/elasticsearch/monitor

1 file changed

+8
-0
lines changed

server/src/main/java/org/elasticsearch/monitor/Probes.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,29 @@
99

1010
package org.elasticsearch.monitor;
1111

12+
import org.apache.logging.log4j.LogManager;
13+
import org.apache.logging.log4j.Logger;
14+
1215
import java.lang.management.OperatingSystemMXBean;
1316
import java.lang.reflect.Method;
1417

1518
public class Probes {
19+
private static final Logger logger = LogManager.getLogger(Probes.class);
20+
1621
public static short getLoadAndScaleToPercent(Method method, OperatingSystemMXBean osMxBean) {
22+
logger.debug("Starting probe of method {} on osMxBean {}", method, osMxBean);
1723
if (method != null) {
1824
try {
1925
double load = (double) method.invoke(osMxBean);
2026
if (load >= 0) {
2127
return (short) (load * 100);
2228
}
2329
} catch (Exception e) {
30+
logger.info(() -> "failed to invoke method [" + method + "] on osMxBean [" + osMxBean + "]", e);
2431
return -1;
2532
}
2633
}
34+
logger.debug("Method is null. Returning default value.");
2735
return -1;
2836
}
2937
}

0 commit comments

Comments
 (0)