You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by pm...@apache.org on 2020/08/17 19:39:18 UTC

[samza] branch master updated: SAMZA-2581: Fix Samza Histogram update to update percentile Gauge values (#1416)

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

pmaheshwari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/samza.git


The following commit(s) were added to refs/heads/master by this push:
     new 216a87f  SAMZA-2581: Fix Samza Histogram update to update percentile Gauge values (#1416)
216a87f is described below

commit 216a87fe4c6fa8e0ed48ad7488e296a88d41376e
Author: Vishwajith Shivappa <vi...@gmail.com>
AuthorDate: Mon Aug 17 12:39:11 2020 -0700

    SAMZA-2581: Fix Samza Histogram update to update percentile Gauge values (#1416)
    
    Symptom: Missing metrics. EventSystemConsumer consumer lag latency
    metrics are missing.
    
    Cause: Histogram update and percentile gauges are updated in two
    different functions. Percentiles are internal to Samza histogram and
    hence should be updated internally as part of update.
    
    Changes: Gauge getValue() also updates percentile metrics.
---
 .../main/java/org/apache/samza/metrics/SamzaHistogram.java    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/samza-api/src/main/java/org/apache/samza/metrics/SamzaHistogram.java b/samza-api/src/main/java/org/apache/samza/metrics/SamzaHistogram.java
index 6ac7615..38cf0fb 100644
--- a/samza-api/src/main/java/org/apache/samza/metrics/SamzaHistogram.java
+++ b/samza-api/src/main/java/org/apache/samza/metrics/SamzaHistogram.java
@@ -72,8 +72,17 @@ public class SamzaHistogram {
     }
 
     public void visit(MetricsVisitor visitor) {
-      updateGaugeValues(percentile);
       visitor.gauge(this);
     }
+
+    /**
+     * We update the percentile gauge values when value is being polled.
+     * This is needed for reporters which do not implement MetricsReporter
+     * and do not have MetricsReporter to update the values.
+     */
+    public Double getValue() {
+      updateGaugeValues(percentile);
+      return super.getValue();
+    }
   }
 }