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


##########
solr/core/src/java/org/apache/solr/metrics/otel/instruments/AttributedInstrumentFactory.java:
##########
@@ -0,0 +1,184 @@
+/*
+ * 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.otel.instruments;
+
+import static org.apache.solr.metrics.SolrMetricProducer.CATEGORY_ATTR;
+import static org.apache.solr.metrics.SolrMetricProducer.HANDLER_ATTR;
+
+import io.opentelemetry.api.common.Attributes;
+import io.opentelemetry.api.metrics.LongCounter;
+import io.opentelemetry.api.metrics.LongHistogram;
+import io.opentelemetry.api.metrics.LongUpDownCounter;
+import org.apache.solr.core.SolrInfoBean;
+import org.apache.solr.metrics.SolrMetricManager;
+import org.apache.solr.metrics.SolrMetricsContext;
+import org.apache.solr.metrics.otel.OtelUnit;
+
+/**
+ * Factory for creating metrics instruments that can write to either single or 
dual registries (core
+ * and node).
+ */
+public class AttributedInstrumentFactory {
+
+  private final SolrMetricsContext primaryMetricsContext;
+  private final Attributes primaryAttributes;
+  private final boolean aggregateToNodeRegistry;
+  private final boolean primaryIsNodeRegistry;
+  private SolrMetricsContext nodeMetricsContext = null;
+  private Attributes nodeAttributes = null;
+
+  public AttributedInstrumentFactory(
+      SolrMetricsContext primaryMetricsContext,
+      Attributes primaryAttributes,
+      boolean aggregateToNodeRegistry) {
+    this.primaryMetricsContext = primaryMetricsContext;
+    this.primaryAttributes = primaryAttributes;
+    this.aggregateToNodeRegistry = aggregateToNodeRegistry;
+
+    // Primary could be a node
+    this.primaryIsNodeRegistry =

Review Comment:
   ADMIN requests 
[here](https://github.com/apache/solr/blob/94e9dfe356ca5a251543edafa778ebc885e80489/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java#L206)
 go through the same block but don't write dual core and node. Its just node 
level requests here so I called it primary.



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