risdenk commented on a change in pull request #669: URL: https://github.com/apache/solr/pull/669#discussion_r810532853
########## File path: solr/prometheus-exporter/src/test/org/apache/solr/prometheus/collector/MetricSamplesTest.java ########## @@ -25,46 +28,48 @@ import java.util.Locale; import java.util.Map; import java.util.stream.Collectors; - -import io.prometheus.client.Collector; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class MetricSamplesTest { private Collector.MetricFamilySamples.Sample sample(String name, Double value) { - return new Collector.MetricFamilySamples.Sample(name, Collections.emptyList(), Collections.emptyList(), value); + return new Collector.MetricFamilySamples.Sample( + name, Collections.emptyList(), Collections.emptyList(), value); } - private Collector.MetricFamilySamples samples(String metricName, Collector.Type type, Collector.MetricFamilySamples.Sample...samples) { + private Collector.MetricFamilySamples samples( + String metricName, Collector.Type type, Collector.MetricFamilySamples.Sample... samples) { return new Collector.MetricFamilySamples( - metricName, - type, - "help", - new ArrayList<>(Arrays.asList(samples)) - ); + metricName, type, "help", new ArrayList<>(Arrays.asList(samples))); } private void validateMetricSamples( List<Collector.MetricFamilySamples> allMetrics, String metricName, List<Double> expectedValues) { - Collector.MetricFamilySamples test1 = allMetrics.stream() - .filter(s -> s.name.equals(metricName)) - .findFirst() - .orElseThrow(() -> new RuntimeException(String.format(Locale.ROOT, "Unable to find item %s", metricName))); - - assertEquals(expectedValues, test1.samples.stream().map(s -> s.value).collect(Collectors.toList())); + Collector.MetricFamilySamples test1 = + allMetrics.stream() + .filter(s -> s.name.equals(metricName)) + .findFirst() + .orElseThrow( + () -> + new RuntimeException( + String.format(Locale.ROOT, "Unable to find item %s", metricName))); Review comment: Fixed in 6f59d6fa54dd1711174bd1e607b7c14e54fa6cd7 ########## File path: solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.java ########## @@ -144,39 +157,68 @@ private SolrScraper createScraper(SolrScrapeConfiguration configuration, Prometh factory.createStandaloneSolrClient(configuration.getSolrHost().get()), requestExecutor); case CLOUD: return new SolrCloudScraper( - factory.createCloudSolrClient(configuration.getZookeeperConnectionString().get()), requestExecutor, factory); + factory.createCloudSolrClient(configuration.getZookeeperConnectionString().get()), + requestExecutor, + factory); default: - throw new RuntimeException(String.format(Locale.ROOT, "Invalid type: %s", configuration.getType())); + throw new RuntimeException( + String.format(Locale.ROOT, "Invalid type: %s", configuration.getType())); Review comment: Fixed in 6f59d6fa54dd1711174bd1e607b7c14e54fa6cd7 ########## File path: solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrClientFactory.java ########## @@ -57,13 +57,18 @@ public CloudSolrClient createCloudSolrClient(String zookeeperConnectionString) { ConnectStringParser parser = new ConnectStringParser(zookeeperConnectionString); - CloudSolrClient.Builder cloudBuilder = new CloudSolrClient.Builder( - parser.getServerAddresses().stream() - .map(address -> String.format(Locale.ROOT, "%s:%s", address.getHostString(), address.getPort())) - .collect(Collectors.toList()), - Optional.ofNullable(parser.getChrootPath())); - - cloudBuilder.withConnectionTimeout(settings.getHttpConnectionTimeout()) + CloudSolrClient.Builder cloudBuilder = + new CloudSolrClient.Builder( + parser.getServerAddresses().stream() + .map( + address -> + String.format( Review comment: Fixed in 6f59d6fa54dd1711174bd1e607b7c14e54fa6cd7 -- 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-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org