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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7de02e837d fix java doc in AbstractMetrics (#10104)
7de02e837d is described below

commit 7de02e837d29a50f9e02d65c529000928afc85a2
Author: Haitao Zhang <hai...@startree.ai>
AuthorDate: Sat Jan 14 18:10:42 2023 -0800

    fix java doc in AbstractMetrics (#10104)
---
 .../pinot/common/metrics/AbstractMetrics.java      | 26 +++++++++-------------
 .../manager/realtime/IngestionDelayTracker.java    |  2 +-
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git 
a/pinot-common/src/main/java/org/apache/pinot/common/metrics/AbstractMetrics.java
 
b/pinot-common/src/main/java/org/apache/pinot/common/metrics/AbstractMetrics.java
index 30045efee5..0ea497d28c 100644
--- 
a/pinot-common/src/main/java/org/apache/pinot/common/metrics/AbstractMetrics.java
+++ 
b/pinot-common/src/main/java/org/apache/pinot/common/metrics/AbstractMetrics.java
@@ -518,7 +518,8 @@ public abstract class AbstractMetrics<QP extends 
AbstractMetrics.QueryPhase, M e
   }
 
   /**
-   * @deprecated please use setOrUpdateTableGauge(final String tableName, 
final G gauge, final long value) instead.
+   * @deprecated please use setOrUpdateTableGauge(final String tableName, 
final G gauge,
+   *     final Supplier<Long> valueSupplier) instead.
    *
    * Adds a new gauge whose values are retrieved from a callback function.
    * This method may be called multiple times, while it will be registered to 
callback function only once.
@@ -534,21 +535,17 @@ public abstract class AbstractMetrics<QP extends 
AbstractMetrics.QueryPhase, M e
   }
 
   /**
-   * @deprecated please use setOrUpdateTableGauge(final String tableName, 
final String key, final G gauge,
-   * final long value) instead.
-   *
-   * Install a per-partition table gauge if needed.
+   * Install a per-partition table gauge.
    *
    * @param tableName The table name
-   * @param partitionId The partition name
+   * @param partitionId The partition id
    * @param gauge The gauge to use
-   * @param valueCallback the callback function to be called while reading the 
metric.
+   * @param valueSupplier The supplier function used to retrieve the value of 
the gauge.
    */
-  @Deprecated
-  public void addCallbackPartitionGaugeIfNeeded(final String tableName, final 
int partitionId, final G gauge,
-      final Callable<Long> valueCallback) {
+  public void setOrUpdatePartitionGauge(final String tableName, final int 
partitionId, final G gauge,
+      final Supplier<Long> valueSupplier) {
     final String fullGaugeName = composeTableGaugeName(tableName, 
String.valueOf(partitionId), gauge);
-    addCallbackGaugeIfNeeded(fullGaugeName, valueCallback);
+    setOrUpdateGauge(fullGaugeName, valueSupplier);
   }
 
   /**
@@ -707,15 +704,14 @@ public abstract class AbstractMetrics<QP extends 
AbstractMetrics.QueryPhase, M e
 
 
   /**
-   * Removes a table gauge given the table name and the gauge.
+   * Removes a table gauge given the table name, the partition id and the 
gauge.
    * The add/remove is expected to work correctly in case of being invoked 
across multiple threads.
    * @param tableName table name
+   * @param partitionId The partition id
    * @param gauge the gauge to be removed
    */
   public void removePartitionGauge(final String tableName, final int 
partitionId, final G gauge) {
-    final String fullGaugeName;
-    String gaugeName = gauge.getGaugeName();
-    fullGaugeName = gaugeName + "." + getTableName(tableName) + "." + 
partitionId;
+    final String fullGaugeName = composeTableGaugeName(tableName, 
String.valueOf(partitionId), gauge);
     removeGauge(fullGaugeName);
   }
 
diff --git 
a/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/IngestionDelayTracker.java
 
b/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/IngestionDelayTracker.java
index 43e72939e3..6452866195 100644
--- 
a/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/IngestionDelayTracker.java
+++ 
b/pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/IngestionDelayTracker.java
@@ -209,7 +209,7 @@ public class IngestionDelayTracker {
         ingestionTimeMs);
     if (previousMeasure == null) {
       // First time we start tracking a partition we should start tracking it 
via metric
-      _serverMetrics.addCallbackPartitionGaugeIfNeeded(_metricName, 
partitionGroupId,
+      _serverMetrics.setOrUpdatePartitionGauge(_metricName, partitionGroupId,
           ServerGauge.REALTIME_INGESTION_DELAY_MS, () -> 
getPartitionIngestionDelayMs(partitionGroupId));
     }
     // If we are consuming we do not need to track this partition for removal.


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

Reply via email to