mirror of https://github.com/apache/druid.git
JvmMonitor: Report jvm/gc/cpu in nanos. (#13383)
Our documentation says we report this in nanos, and we actually did prior to #12481. This patch restores the prior behavior.
This commit is contained in:
parent
6ccf31490e
commit
092e769dd8
|
@ -187,7 +187,7 @@ public class JvmMonitor extends FeedDefiningMonitor
|
||||||
private final GarbageCollectorMXBean gcBean;
|
private final GarbageCollectorMXBean gcBean;
|
||||||
|
|
||||||
private long lastInvocations = 0;
|
private long lastInvocations = 0;
|
||||||
private long lastCpuNanos = 0;
|
private long lastCpuMillis = 0;
|
||||||
|
|
||||||
private static final String GC_YOUNG_GENERATION_NAME = "young";
|
private static final String GC_YOUNG_GENERATION_NAME = "young";
|
||||||
private static final String GC_OLD_GENERATION_NAME = "old";
|
private static final String GC_OLD_GENERATION_NAME = "old";
|
||||||
|
@ -268,10 +268,10 @@ public class JvmMonitor extends FeedDefiningMonitor
|
||||||
emitter.emit(builder.build("jvm/gc/count", newInvocations - lastInvocations));
|
emitter.emit(builder.build("jvm/gc/count", newInvocations - lastInvocations));
|
||||||
lastInvocations = newInvocations;
|
lastInvocations = newInvocations;
|
||||||
|
|
||||||
long newCpuNanos = gcBean.getCollectionTime();
|
// getCollectionTime is in milliseconds; we report jvm/gc/cpu in nanoseconds.
|
||||||
emitter.emit(builder.build("jvm/gc/cpu", newCpuNanos - lastCpuNanos));
|
long newCpuMillis = gcBean.getCollectionTime();
|
||||||
lastCpuNanos = newCpuNanos;
|
emitter.emit(builder.build("jvm/gc/cpu", (newCpuMillis - lastCpuMillis) * 1_000_000L));
|
||||||
|
lastCpuMillis = newCpuMillis;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue