You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2023/08/31 11:30:33 UTC

[dubbo] branch 3.2 updated: Check before init agg metrics (#12989)

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

albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.2 by this push:
     new 025c078948 Check before init agg metrics (#12989)
025c078948 is described below

commit 025c0789485be46abdf9ef8cc7b393dff2344a96
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Thu Aug 31 19:30:27 2023 +0800

    Check before init agg metrics (#12989)
---
 .../dubbo/metrics/collector/AggregateMetricsCollector.java | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/dubbo-metrics/dubbo-metrics-default/src/main/java/org/apache/dubbo/metrics/collector/AggregateMetricsCollector.java b/dubbo-metrics/dubbo-metrics-default/src/main/java/org/apache/dubbo/metrics/collector/AggregateMetricsCollector.java
index 2f04416bf2..ff7abf5d3c 100644
--- a/dubbo-metrics/dubbo-metrics-default/src/main/java/org/apache/dubbo/metrics/collector/AggregateMetricsCollector.java
+++ b/dubbo-metrics/dubbo-metrics-default/src/main/java/org/apache/dubbo/metrics/collector/AggregateMetricsCollector.java
@@ -267,10 +267,16 @@ public class AggregateMetricsCollector implements MetricsCollector<RequestEvent>
     @Override
     public void initMetrics(MetricsEvent event) {
         MethodMetric metric = new MethodMetric(applicationModel, event.getAttachmentValue(MetricsConstants.INVOCATION));
-        initMethodMetric(event);
-        initQpsMetric(metric);
-        initRtMetric(metric);
-        initRtAgrMetric(metric);
+        if (enableQps) {
+            initMethodMetric(event);
+            initQpsMetric(metric);
+        }
+        if (enableRt) {
+            initRtMetric(metric);
+        }
+        if (enableRtPxx) {
+            initRtAgrMetric(metric);
+        }
     }
 
     public void initMethodMetric(MetricsEvent event){