dsmiley commented on code in PR #3444:
URL: https://github.com/apache/solr/pull/3444#discussion_r2241155518


##########
solr/solrj/src/test/org/apache/solr/client/solrj/SolrJMetricTestUtils.java:
##########
@@ -36,20 +36,17 @@ public static double 
getPrometheusMetricValue(CloudSolrClient solrClient, String
             SolrRequest.METHOD.GET,
             "/admin/metrics",
             SolrRequest.SolrRequestType.ADMIN,
-            new ModifiableSolrParams().set("wt", "prometheus"));
+            SolrParams.of("wt", "prometheus"));
     req.setResponseParser(new InputStreamResponseParser("prometheus"));
 
     NamedList<Object> resp = solrClient.request(req);
     try (InputStream in = (InputStream) resp.get("stream")) {
       String output = new String(in.readAllBytes(), StandardCharsets.UTF_8);
-      var line =
-          output
-              .lines()
-              .filter(l -> l.startsWith(metricName))
-              .findFirst()
-              .orElseThrow(() -> new AssertionError("Metric not found: " + 
metricName));
-
-      return Double.parseDouble(line.substring(line.lastIndexOf(" ") + 
1).trim());
+      return output
+          .lines()
+          .filter(l -> l.startsWith(metricName))
+          .mapToDouble(s -> Double.parseDouble(s.substring(s.lastIndexOf(" ") 
+ 1).trim()))

Review Comment:
   The plus one results in a space that you then remove with a trim.  So can't 
you skip both and simplify?



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