You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by jl...@apache.org on 2021/02/28 01:47:01 UTC

[incubator-pinot] branch add-count-method-in-pinot-meter updated (c959010 -> 0f7bd78)

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

jlli pushed a change to branch add-count-method-in-pinot-meter
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git.


 discard c959010  Add count method in PinotMeter interface
     new 0f7bd78  Add mark and count methods in PinotMeter interface

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (c959010)
            \
             N -- N -- N   refs/heads/add-count-method-in-pinot-meter (0f7bd78)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../pinot/common/metrics/yammer/YammerMeter.java   |  5 +++++
 .../pinot/common/metrics/MetricsHelperTest.java    | 22 +++++++++++++++++-----
 .../org/apache/pinot/spi/metrics/PinotMeter.java   |  2 ++
 3 files changed, 24 insertions(+), 5 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[incubator-pinot] 01/01: Add mark and count methods in PinotMeter interface

Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jlli pushed a commit to branch add-count-method-in-pinot-meter
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 0f7bd7805fcf93f351198aabf76b8c5c88691a79
Author: Jack Li(Analytics Engineering) <jl...@jlli-mn1.linkedin.biz>
AuthorDate: Sat Feb 27 17:35:53 2021 -0800

    Add mark and count methods in PinotMeter interface
---
 .../pinot/common/metrics/yammer/YammerMeter.java   | 10 ++++++++++
 .../pinot/common/metrics/MetricsHelperTest.java    | 22 +++++++++++++++++-----
 .../org/apache/pinot/spi/metrics/PinotMeter.java   |  4 ++++
 3 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/yammer/YammerMeter.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/yammer/YammerMeter.java
index d480b43..92a350b 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/yammer/YammerMeter.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/yammer/YammerMeter.java
@@ -31,11 +31,21 @@ public class YammerMeter extends YammerMetered implements PinotMeter {
   }
 
   @Override
+  public void mark() {
+    _meter.mark();
+  }
+
+  @Override
   public void mark(long unitCount) {
     _meter.mark(unitCount);
   }
 
   @Override
+  public long count() {
+    return _meter.count();
+  }
+
+  @Override
   public Object getMetric() {
     return _meter;
   }
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/metrics/MetricsHelperTest.java b/pinot-common/src/test/java/org/apache/pinot/common/metrics/MetricsHelperTest.java
index 5afe60d..24507c9 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/metrics/MetricsHelperTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/metrics/MetricsHelperTest.java
@@ -18,15 +18,14 @@
  */
 package org.apache.pinot.common.metrics;
 
-import static org.testng.Assert.assertTrue;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
-
 import org.apache.pinot.common.exception.InvalidConfigException;
+import org.apache.pinot.spi.metrics.PinotMeter;
 import org.apache.pinot.spi.metrics.PinotMetricsRegistry;
 import org.apache.pinot.spi.env.PinotConfiguration;
+import org.testng.Assert;
 import org.testng.annotations.Test;
 
 
@@ -73,7 +72,20 @@ public class MetricsHelperTest {
         TimeUnit.MILLISECONDS, TimeUnit.MILLISECONDS);
 
     // Check that the two listeners fired
-    assertTrue(listenerOneOkay);
-    assertTrue(listenerTwoOkay);
+    Assert.assertTrue(listenerOneOkay);
+    Assert.assertTrue(listenerTwoOkay);
+  }
+
+  @Test
+  public void testMetricValue() {
+    PinotMetricsRegistry registry = PinotMetricUtils.getPinotMetricsRegistry();
+    PinotMeter pinotMeter = MetricsHelper
+        .newMeter(registry, PinotMetricUtils.generatePinotMetricName(MetricsHelperTest.class, "testMeter"), "testMeter",
+            TimeUnit.MILLISECONDS);
+    pinotMeter.mark();
+    Assert.assertEquals(pinotMeter.count(), 1L);
+
+    pinotMeter.mark(2L);
+    Assert.assertEquals(pinotMeter.count(), 3L);
   }
 }
diff --git a/pinot-spi/src/main/java/org/apache/pinot/spi/metrics/PinotMeter.java b/pinot-spi/src/main/java/org/apache/pinot/spi/metrics/PinotMeter.java
index f7b9c94..778e32e 100644
--- a/pinot-spi/src/main/java/org/apache/pinot/spi/metrics/PinotMeter.java
+++ b/pinot-spi/src/main/java/org/apache/pinot/spi/metrics/PinotMeter.java
@@ -26,5 +26,9 @@ package org.apache.pinot.spi.metrics;
  */
 public interface PinotMeter {
 
+  void mark();
+
   void mark(final long unitCount);
+
+  long count();
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org