Skip to content
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

add a unique id for GC events so that events from a single JVM can be grouped #1721

Merged
merged 2 commits into from
Jun 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import java.lang.management.MemoryUsage;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.ExecutorService;

/**
Expand All @@ -24,6 +25,11 @@
public class GcEventMonitor {
private static final Logger LOGGER = LoggerFactory.getLogger(GcEventMonitor.class);

// a unique jvm_instance_id is needed for every restart as the gc starts again from scratch every time
// the JVM is restarted, and we need to analyze single JVM execution
//TODO if/when Application Insights adds a unique ID that represents a single JVM, pull that ID here
trask marked this conversation as resolved.
Show resolved Hide resolved
private static final String JVM_INSTANCE_UID = UUID.randomUUID().toString();
Comment on lines +30 to +31
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does role instance work for this? or is it required to get a different different value on each restart of a single JVM?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it needs to be different for every restart as the gc starts again from scratch every time the JVM is restarted, and we need to analyse single JVMs


public static class GcEventMonitorConfiguration {
public final GcReportingLevel reportingLevel;

Expand Down Expand Up @@ -106,6 +112,7 @@ private static void emitGcEvent(TelemetryClient telemetryClient, GcEventMonitorC
gcEvent.getProperties().put("collector", event.getCollector().getName());
gcEvent.getProperties().put("type", event.getGcCause());
gcEvent.getProperties().put("action", event.getGcAction());
gcEvent.getProperties().put("jvm_instance_id", JVM_INSTANCE_UID);
gcEvent.getMetrics().put("id", (double) event.getId());
gcEvent.getMetrics().put("duration_ms", (double) event.getDuration());
gcEvent.getMetrics().put("end_time_ms", (double) event.getEndTime());
Expand Down