Skip to content

Commit b1d2d0b

Browse files
committed
Merge pull request #15 from brharrington/live-data-size
Fix issue #2.
2 parents 5388640 + 468992a commit b1d2d0b

File tree

1 file changed

+4
-1
lines changed
  • spectator-ext-gc/src/main/java/com/netflix/spectator/gc

1 file changed

+4
-1
lines changed

spectator-ext-gc/src/main/java/com/netflix/spectator/gc/GcLogger.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ private void updateMetrics(String name, GcInfo info) {
162162
PROMOTION_RATE.increment(delta);
163163
}
164164

165-
if (HelperFunctions.getGcType(name) == GcType.OLD) {
165+
// Some GCs such as G1 can reduce the old gen size as part of a minor GC. To track the
166+
// live data size we record the value if we see a reduction in the old gen heap size or
167+
// after a major GC.
168+
if (oldAfter < oldBefore || HelperFunctions.getGcType(name) == GcType.OLD) {
166169
LIVE_DATA_SIZE.set(oldAfter);
167170
final long oldMaxAfter = after.get(oldGenPoolName).getMax();
168171
MAX_DATA_SIZE.set(oldMaxAfter);

0 commit comments

Comments
 (0)