Skip to content

Commit

Permalink
Add gc as a tag for gc metrics
Browse files Browse the repository at this point in the history
- When observing multiple applications(which run on different java versions / use different gc's) having gc has a dimension helps in better understanding the gc metrics.
  • Loading branch information
lenin-jaganathan committed Feb 17, 2023
1 parent 128aa0c commit 641022b
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,19 @@ public void handleNotification(Notification notification, Object ref) {
CompositeData cd = (CompositeData) notification.getUserData();
GarbageCollectionNotificationInfo notificationInfo = GarbageCollectionNotificationInfo.from(cd);

String gcName = notificationInfo.getGcName();
String gcCause = notificationInfo.getGcCause();
String gcAction = notificationInfo.getGcAction();
GcInfo gcInfo = notificationInfo.getGcInfo();
long duration = gcInfo.getDuration();
if (isConcurrentPhase(gcCause, notificationInfo.getGcName())) {
Timer.builder("jvm.gc.concurrent.phase.time").tags(tags).tags("action", gcAction, "cause", gcCause)
if (isConcurrentPhase(gcCause, gcName)) {
Timer.builder("jvm.gc.concurrent.phase.time").tags(tags)
.tags("action", gcAction, "cause", gcCause, "gc_name", gcName)
.description("Time spent in concurrent phase").register(registry)
.record(duration, TimeUnit.MILLISECONDS);
}
else {
Timer.builder("jvm.gc.pause").tags(tags).tags("action", gcAction, "cause", gcCause)
Timer.builder("jvm.gc.pause").tags(tags).tags("action", gcAction, "cause", gcCause, "gc", gcName)
.description("Time spent in GC pause").register(registry)
.record(duration, TimeUnit.MILLISECONDS);
}
Expand Down

0 comments on commit 641022b

Please sign in to comment.