This is an automated email from the ASF dual-hosted git repository.

technoboy pushed a commit to branch branch-2.11
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.11 by this push:
     new a4e4561fd3d [improve][monitor] Add JVM start time metric (#20381)
a4e4561fd3d is described below

commit a4e4561fd3dd3f558e899c2674035c5b57971c2f
Author: Jiwei Guo <[email protected]>
AuthorDate: Wed May 24 15:06:34 2023 +0800

    [improve][monitor] Add JVM start time metric (#20381)
---
 .../src/main/java/org/apache/pulsar/common/stats/JvmMetrics.java       | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/pulsar-common/src/main/java/org/apache/pulsar/common/stats/JvmMetrics.java 
b/pulsar-common/src/main/java/org/apache/pulsar/common/stats/JvmMetrics.java
index 737c6dd197e..4f80f21b3d1 100644
--- a/pulsar-common/src/main/java/org/apache/pulsar/common/stats/JvmMetrics.java
+++ b/pulsar-common/src/main/java/org/apache/pulsar/common/stats/JvmMetrics.java
@@ -99,6 +99,9 @@ public class JvmMetrics {
 
         Runtime r = Runtime.getRuntime();
 
+        RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
+
+        m.put("jvm_start_time", runtimeMXBean.getStartTime());
         m.put("jvm_heap_used", r.totalMemory() - r.freeMemory());
         m.put("jvm_max_memory", r.maxMemory());
         m.put("jvm_total_memory", r.totalMemory());

Reply via email to