-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add additional logging to make spotting stats issues easier #133972
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
Changes from 4 commits
483ba7f
f5864bd
ba1bbaa
8efbd2c
eec20cd
715cc48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
|
|
||
| package org.elasticsearch.monitor.jvm; | ||
|
|
||
| import org.apache.logging.log4j.Logger; | ||
| import org.elasticsearch.TransportVersions; | ||
| import org.elasticsearch.common.io.stream.StreamInput; | ||
| import org.elasticsearch.common.io.stream.StreamOutput; | ||
|
|
@@ -30,10 +31,14 @@ | |
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| import static org.apache.logging.log4j.LogManager.getLogger; | ||
|
|
||
| public class JvmInfo implements ReportingService.Info { | ||
|
|
||
| private static final JvmInfo INSTANCE; | ||
|
|
||
| private static final Logger logger = getLogger(JvmInfo.class); | ||
|
|
||
| static { | ||
| RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); | ||
| MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); | ||
|
|
@@ -94,47 +99,63 @@ public class JvmInfo implements ReportingService.Info { | |
| try { | ||
| Object onErrorObject = vmOptionMethod.invoke(hotSpotDiagnosticMXBean, "OnError"); | ||
| onError = (String) valueMethod.invoke(onErrorObject); | ||
| } catch (Exception ignored) {} | ||
| } catch (Exception e) { | ||
| logger.info("Error getting JVM info from MX Bean", e); | ||
|
||
| } | ||
|
|
||
| try { | ||
| Object onOutOfMemoryErrorObject = vmOptionMethod.invoke(hotSpotDiagnosticMXBean, "OnOutOfMemoryError"); | ||
| onOutOfMemoryError = (String) valueMethod.invoke(onOutOfMemoryErrorObject); | ||
| } catch (Exception ignored) {} | ||
| } catch (Exception e) { | ||
| logger.info("Error getting JVM info from MX Bean", e); | ||
| } | ||
|
|
||
| try { | ||
| Object useCompressedOopsVmOptionObject = vmOptionMethod.invoke(hotSpotDiagnosticMXBean, "UseCompressedOops"); | ||
| useCompressedOops = (String) valueMethod.invoke(useCompressedOopsVmOptionObject); | ||
| } catch (Exception ignored) {} | ||
| } catch (Exception e) { | ||
| logger.info("Error getting JVM info from MX Bean", e); | ||
| } | ||
|
|
||
| try { | ||
| Object useG1GCVmOptionObject = vmOptionMethod.invoke(hotSpotDiagnosticMXBean, "UseG1GC"); | ||
| useG1GC = (String) valueMethod.invoke(useG1GCVmOptionObject); | ||
| Object regionSizeVmOptionObject = vmOptionMethod.invoke(hotSpotDiagnosticMXBean, "G1HeapRegionSize"); | ||
| g1RegisionSize = Long.parseLong((String) valueMethod.invoke(regionSizeVmOptionObject)); | ||
| } catch (Exception ignored) {} | ||
| } catch (Exception e) { | ||
| logger.info("Error getting JVM info from MX Bean", e); | ||
| } | ||
|
|
||
| try { | ||
| Object initialHeapSizeVmOptionObject = vmOptionMethod.invoke(hotSpotDiagnosticMXBean, "InitialHeapSize"); | ||
| configuredInitialHeapSize = Long.parseLong((String) valueMethod.invoke(initialHeapSizeVmOptionObject)); | ||
| } catch (Exception ignored) {} | ||
| } catch (Exception e) { | ||
| logger.info("Error getting JVM info from MX Bean", e); | ||
| } | ||
|
|
||
| try { | ||
| Object maxHeapSizeVmOptionObject = vmOptionMethod.invoke(hotSpotDiagnosticMXBean, "MaxHeapSize"); | ||
| configuredMaxHeapSize = Long.parseLong((String) valueMethod.invoke(maxHeapSizeVmOptionObject)); | ||
| } catch (Exception ignored) {} | ||
| } catch (Exception e) { | ||
| logger.info("Error getting JVM info from MX Bean", e); | ||
| } | ||
|
|
||
| try { | ||
| Object maxDirectMemorySizeVmOptionObject = vmOptionMethod.invoke(hotSpotDiagnosticMXBean, "MaxDirectMemorySize"); | ||
| directMemoryMax = Long.parseLong((String) valueMethod.invoke(maxDirectMemorySizeVmOptionObject)); | ||
| } catch (Exception ignored) {} | ||
| } catch (Exception e) { | ||
| logger.info("Error getting JVM info from MX Bean", e); | ||
| } | ||
|
|
||
| try { | ||
| Object useSerialGCVmOptionObject = vmOptionMethod.invoke(hotSpotDiagnosticMXBean, "UseSerialGC"); | ||
| useSerialGC = (String) valueMethod.invoke(useSerialGCVmOptionObject); | ||
| } catch (Exception ignored) {} | ||
|
|
||
| } catch (Exception ignored) { | ||
| } catch (Exception e) { | ||
| logger.info("Error getting JVM info from MX Bean", e); | ||
| } | ||
|
|
||
| } catch (Exception e) { | ||
| logger.info("Error getting JVM info from MX Bean", e); | ||
| } | ||
|
|
||
| Mem mem = new Mem(heapInit, heapMax, nonHeapInit, nonHeapMax, directMemoryMax); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.