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


##########
solr/cross-dc-manager/src/java/org/apache/solr/crossdc/manager/consumer/PrometheusMetrics.java:
##########
@@ -0,0 +1,158 @@
+/*
+ * 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.crossdc.manager.consumer;
+
+import io.prometheus.metrics.core.datapoints.Timer;
+import io.prometheus.metrics.core.metrics.Counter;
+import io.prometheus.metrics.core.metrics.Histogram;
+import io.prometheus.metrics.model.registry.PrometheusRegistry;
+import org.apache.solr.client.solrj.SolrRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.crossdc.common.MirroredSolrRequest;
+
+public class PrometheusMetrics implements ConsumerMetrics {
+
+  protected PrometheusRegistry registry;
+  protected Counter input;
+  protected Counter collapsed;
+  protected Counter output;
+  protected Histogram outputBatchSizeHistogram;
+  protected Histogram outputTimeHistogram;
+  protected Histogram outputBackoffHistogram;
+  protected Histogram outputFirstAttemptHistogram;
+
+  public PrometheusMetrics() {
+    register(PrometheusRegistry.defaultRegistry);
+  }
+
+  protected void register(PrometheusRegistry registry) {
+    this.registry = registry;
+    input =
+        Counter.builder()
+            .name("consumer_input_total")
+            .help("Total number of input messages")
+            .labelNames("type", "subtype")

Review Comment:
   Hmmm ok. I am not a fan of naming this label being called `type`. I think it 
should have some kind of context what it means as type and subtype can be very 
generic. Is it an `operation` or `message_type` maybe? Then what can subtype 
be? In core, I made it `category` but it is debateable if we should just remove 
that label/attribute all together from metrics. If you move `type` to something 
more specific then maybe you can just move off subtype to type. Again seeing an 
sample text output of these metrics would help if you can.



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