You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by GitBox <gi...@apache.org> on 2019/11/22 06:31:08 UTC

[GitHub] [samza] rmatharu commented on a change in pull request #1223: SAMZA-2397: Updating gauge-val function on newGauge on same metric name

rmatharu commented on a change in pull request #1223: SAMZA-2397: Updating gauge-val function on newGauge on same metric name
URL: https://github.com/apache/samza/pull/1223#discussion_r349449038
 
 

 ##########
 File path: samza-core/src/main/scala/org/apache/samza/metrics/MetricsRegistryMap.scala
 ##########
 @@ -51,7 +51,10 @@ class MetricsRegistryMap(val name: String) extends ReadableMetricsRegistry with
 
   def newGauge[T](group: String, gauge: Gauge[T]) = {
     debug("Adding new gauge %s %s %s." format (group, gauge.getName, gauge))
-    putAndGetGroup(group).putIfAbsent(gauge.getName, gauge)
+    if (putAndGetGroup(group).containsKey(gauge.getName)) {
+      info("Updating existing gauge %s %s %s" format (group, gauge.getName, gauge))
+    }
+    putAndGetGroup(group).put(gauge.getName, gauge)
 
 Review comment:
   Should we do this for all other metric types -- timers, etc, and methods to create them. 
   Last metric overrides -- Is this not the desired semantics?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services