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

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


The following commit(s) were added to refs/heads/branch-2.9 by this push:
     new 1ad91092d16 [fix][metrics] fixed ProxyStats to use 
common.stats.JvmMetrics (#15692)
1ad91092d16 is described below

commit 1ad91092d16bffe40403518bd844b2ef9b86e6b7
Author: Heesung Sohn <103456639+heesung...@users.noreply.github.com>
AuthorDate: Tue Jun 7 16:19:22 2022 -0700

    [fix][metrics] fixed ProxyStats to use common.stats.JvmMetrics (#15692)
    
    Co-authored-by: Matteo Merli <mme...@apache.org>
    (cherry picked from commit 7eeeba1481571133d6d038cd36ca35837126680d)
---
 .../src/main/java/org/apache/pulsar/websocket/stats/ProxyStats.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/stats/ProxyStats.java
 
b/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/stats/ProxyStats.java
index 8fa91130ae4..5795c386656 100644
--- 
a/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/stats/ProxyStats.java
+++ 
b/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/stats/ProxyStats.java
@@ -26,6 +26,7 @@ import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.pulsar.common.naming.TopicName;
+import org.apache.pulsar.common.stats.JvmMetrics;
 import org.apache.pulsar.common.stats.Metrics;
 import org.apache.pulsar.common.util.collections.ConcurrentOpenHashMap;
 import org.apache.pulsar.websocket.WebSocketService;
@@ -51,7 +52,8 @@ public class ProxyStats {
     public ProxyStats(WebSocketService service) {
         super();
         this.service = service;
-        this.jvmMetrics = new JvmMetrics(service);
+        this.jvmMetrics = JvmMetrics.create(
+                service.getExecutor(), "prx", 
service.getConfig().getJvmGCMetricsLoggerClassName());
         this.topicStats =
                 ConcurrentOpenHashMap.<String, ProxyNamespaceStats>newBuilder()
                         .build();
@@ -113,7 +115,7 @@ public class ProxyStats {
         if (log.isDebugEnabled()) {
             log.debug("Add jvm-stats to metrics");
         }
-        tempMetricsCollection.add(jvmMetrics.generate());
+        tempMetricsCollection.add(jvmMetrics.generate().get(0));
 
         // swap tempmetrics to stat-metrics
         List<Metrics> tempRef = metricsCollection;

Reply via email to