mlbiscoc commented on code in PR #2405:
URL: https://github.com/apache/solr/pull/2405#discussion_r1612224963


##########
solr/core/src/java/org/apache/solr/metrics/prometheus/core/SolrCoreSearcherMetric.java:
##########
@@ -47,24 +45,18 @@ public SolrCoreMetric parseLabels() {
   }
 
   @Override
-  public void toPrometheus(SolrPrometheusCoreExporter 
solrPrometheusCoreRegistry) {
+  public void toPrometheus(SolrPrometheusCoreExporter 
solrPrometheusCoreExporter) {

Review Comment:
   Changed to just exporter. It still makes sense, I was always just big on 
verbosity but shorter names for one-liners is better.



##########
solr/core/src/java/org/apache/solr/response/PrometheusResponseWriter.java:
##########
@@ -16,31 +16,115 @@
  */
 package org.apache.solr.response;
 
+import com.codahale.metrics.Histogram;
+import com.codahale.metrics.Metric;
+import com.codahale.metrics.MetricFilter;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Timer;
 import io.prometheus.metrics.expositionformats.PrometheusTextFormatWriter;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.lang.invoke.MethodHandles;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
 import org.apache.solr.common.util.NamedList;
+import org.apache.solr.metrics.AggregateMetric;
 import org.apache.solr.metrics.prometheus.SolrPrometheusCoreExporter;
 import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.util.stats.MetricUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+/**
+ * Response writer for Prometheus metrics. This is used only by the {@link
+ * org.apache.solr.handler.admin.MetricsHandler}
+ */
 @SuppressWarnings(value = "unchecked")
 public class PrometheusResponseWriter extends RawResponseWriter {
+  private static final Logger log = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
   @Override
   public void write(OutputStream out, SolrQueryRequest request, 
SolrQueryResponse response)
       throws IOException {
     NamedList<Object> prometheusRegistries =
         (NamedList<Object>) response.getValues().get("metrics");
-    Map<String, Object> registryMap = prometheusRegistries.asShallowMap();
-    PrometheusTextFormatWriter prometheusTextFormatWriter = new 
PrometheusTextFormatWriter(false);
-    registryMap.forEach(
-        (name, registry) -> {
+    Iterator<Map.Entry<String, Object>> it = prometheusRegistries.iterator();

Review Comment:
   Changed to for loop syntax



##########
solr/core/src/java/org/apache/solr/metrics/prometheus/PrometheusExporterInfo.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.metrics.prometheus;
+
+public interface PrometheusExporterInfo {
+  /** Category of prefix Solr Core dropwizard handler metric names */
+  enum CoreCategory {

Review Comment:
   Implemented it on `SolrPrometheusCoreExporter` instead. It is `CORE` 
specific so you are correct. Doesn't make sense implementing on the base class.



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

Reply via email to