sigram commented on a change in pull request #825: SOLR-13677 All Metrics 
Gauges should be unregistered by the objects that registered them
URL: https://github.com/apache/lucene-solr/pull/825#discussion_r312820738
 
 

 ##########
 File path: solr/core/src/java/org/apache/solr/metrics/SolrMetricManager.java
 ##########
 @@ -698,19 +726,22 @@ public int unregisterGauges(String registryName, String 
tag) {
     MetricRegistry registry = registry(registryName);
     AtomicInteger removed = new AtomicInteger();
     registry.removeMatching((name, metric) -> {
-      if (metric instanceof GaugeWrapper &&
-          tag.equals(((GaugeWrapper)metric).getTag())) {
-        removed.incrementAndGet();
-        return true;
-      } else {
-        return false;
+      if (metric instanceof GaugeWrapper) {
+        String tagVal = ((GaugeWrapper) metric).getTag();
+        if(tagVal.equals(tag) ||
+            tagVal.contains(tag)){
 
 Review comment:
   Maybe we should at least rename the method parameter to indicate that the 
`tag` is really a `containsTag` match? Otherwise users could expect that this 
method only unregisters exact matches.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to