This is an automated email from the ASF dual-hosted git repository.
abhishek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push:
new 092e769dd8 JvmMonitor: Report jvm/gc/cpu in nanos. (#13383)
092e769dd8 is described below
commit 092e769dd84d2f3b051d35b4b64b8fd4f00ac788
Author: Gian Merlino <[email protected]>
AuthorDate: Thu Nov 17 23:03:16 2022 -0800
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.
---
.../java/org/apache/druid/java/util/metrics/JvmMonitor.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git
a/core/src/main/java/org/apache/druid/java/util/metrics/JvmMonitor.java
b/core/src/main/java/org/apache/druid/java/util/metrics/JvmMonitor.java
index 7c9f6be99d..524a8dc87f 100644
--- a/core/src/main/java/org/apache/druid/java/util/metrics/JvmMonitor.java
+++ b/core/src/main/java/org/apache/druid/java/util/metrics/JvmMonitor.java
@@ -187,7 +187,7 @@ public class JvmMonitor extends FeedDefiningMonitor
private final GarbageCollectorMXBean gcBean;
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_OLD_GENERATION_NAME = "old";
@@ -268,10 +268,10 @@ public class JvmMonitor extends FeedDefiningMonitor
emitter.emit(builder.build("jvm/gc/count", newInvocations -
lastInvocations));
lastInvocations = newInvocations;
- long newCpuNanos = gcBean.getCollectionTime();
- emitter.emit(builder.build("jvm/gc/cpu", newCpuNanos - lastCpuNanos));
- lastCpuNanos = newCpuNanos;
-
+ // getCollectionTime is in milliseconds; we report jvm/gc/cpu in
nanoseconds.
+ long newCpuMillis = gcBean.getCollectionTime();
+ emitter.emit(builder.build("jvm/gc/cpu", (newCpuMillis - lastCpuMillis)
* 1_000_000L));
+ lastCpuMillis = newCpuMillis;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]