You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "mkhludnev (via GitHub)" <gi...@apache.org> on 2026/09/17 20:08:10 UTC

Re: [PR] SOLR-18455: actually disable metrics on [solr]

mkhludnev commented on code in PR #4902:
URL: https://github.com/apache/solr/pull/4902#discussion_r4041009596


##########
solr/core/src/java/org/apache/solr/metrics/SolrMetricManager.java:
##########
@@ -405,16 +367,19 @@ private LongCounterBuilder longCounterBuilder(
   private DoubleCounterBuilder doubleCounterBuilder(
       String registry, String counterName, String description, OtelUnit unit) {
     DoubleCounterBuilder builder =
-        meterProvider(registry)
-            .get(OTEL_SCOPE_NAME)
-            .counterBuilder(counterName)
-            .setDescription(description)
-            .ofDoubles();
+        meter(registry).counterBuilder(counterName).setDescription(description).ofDoubles();
     if (unit != null) builder.setUnit(unit.getSymbol());
 
     return builder;
   }
 
+  private Meter meter(String registry) {
+    if (!enabled) {
+      return OpenTelemetry.noop().getMeterProvider().get(OTEL_SCOPE_NAME);
+    }
+    return meterProvider(registry).get(OTEL_SCOPE_NAME);
+  }

Review Comment:
   done



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org