sigram commented on code in PR #4917:
URL: https://github.com/apache/solr/pull/4917#discussion_r4035038227


##########
solr/core/src/java/org/apache/solr/metrics/SolrMetricsContext.java:
##########
@@ -160,65 +160,67 @@ public DoubleGauge doubleGauge(String metricName, String 
description, OtelUnit u
 
   public ObservableLongGauge observableLongGauge(
       String metricName, String description, 
Consumer<ObservableLongMeasurement> callback) {
-    var observableLongGauge = observableLongGauge(metricName, description, 
callback, null);
-    closeables.add(observableLongGauge);
-    return observableLongGauge;
+    return observableLongGauge(metricName, description, callback, null);
   }
 
   public ObservableLongGauge observableLongGauge(
       String metricName,
       String description,
       Consumer<ObservableLongMeasurement> callback,
       OtelUnit unit) {
-    return metricManager.observableLongGauge(registryName, metricName, 
description, callback, unit);
+    var observableLongGauge =
+        metricManager.observableLongGauge(registryName, metricName, 
description, callback, unit);
+    closeables.add(observableLongGauge);
+    return observableLongGauge;

Review Comment:
   As for the timing wrt 10.1 release... This minimal fix here addresses the 
immediate problem, perhaps refactoring could be scheduled for later?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to