|
14 | 14 |
|
15 | 15 | import java.lang.management.MemoryUsage; |
16 | 16 | import java.util.Optional; |
| 17 | +import java.util.UUID; |
17 | 18 | import java.util.concurrent.ExecutorService; |
18 | 19 |
|
19 | 20 | /** |
|
24 | 25 | public class GcEventMonitor { |
25 | 26 | private static final Logger LOGGER = LoggerFactory.getLogger(GcEventMonitor.class); |
26 | 27 |
|
| 28 | + // a unique jvm_instance_id is needed for every restart as the gc starts again from scratch every time |
| 29 | + // the JVM is restarted, and we need to analyze single JVM execution |
| 30 | + //TODO if/when Application Insights adds a unique ID that represents a single JVM, pull that ID here |
| 31 | + private static final String JVM_INSTANCE_UID = UUID.randomUUID().toString(); |
| 32 | + |
27 | 33 | public static class GcEventMonitorConfiguration { |
28 | 34 | public final GcReportingLevel reportingLevel; |
29 | 35 |
|
@@ -106,6 +112,7 @@ private static void emitGcEvent(TelemetryClient telemetryClient, GcEventMonitorC |
106 | 112 | gcEvent.getProperties().put("collector", event.getCollector().getName()); |
107 | 113 | gcEvent.getProperties().put("type", event.getGcCause()); |
108 | 114 | gcEvent.getProperties().put("action", event.getGcAction()); |
| 115 | + gcEvent.getProperties().put("jvm_instance_id", JVM_INSTANCE_UID); |
109 | 116 | gcEvent.getMetrics().put("id", (double) event.getId()); |
110 | 117 | gcEvent.getMetrics().put("duration_ms", (double) event.getDuration()); |
111 | 118 | gcEvent.getMetrics().put("end_time_ms", (double) event.getEndTime()); |
|
0 commit comments