dsmiley commented on code in PR #3668:
URL: https://github.com/apache/solr/pull/3668#discussion_r2359211840
##########
solr/core/src/java/org/apache/solr/handler/component/SuggestComponent.java:
##########
@@ -519,6 +518,12 @@ private SuggesterResult toSuggesterResult(
return result;
}
+ @Override
+ public void close() throws IOException {
+ super.close();
+ IOUtils.closeQuietly(toClose);
Review Comment:
nit: normally you close down yourself first, then what's beneath you.
Reverse order of construction.
##########
solr/modules/cross-dc/src/java/org/apache/solr/crossdc/update/processor/ProducerMetrics.java:
##########
@@ -16,72 +16,114 @@
*/
package org.apache.solr.crossdc.update.processor;
-import com.codahale.metrics.Counter;
-import com.codahale.metrics.Histogram;
+import static org.apache.solr.metrics.SolrCoreMetricManager.COLLECTION_ATTR;
+import static org.apache.solr.metrics.SolrCoreMetricManager.CORE_ATTR;
+import static org.apache.solr.metrics.SolrCoreMetricManager.REPLICA_ATTR;
+import static org.apache.solr.metrics.SolrCoreMetricManager.SHARD_ATTR;
+import static org.apache.solr.metrics.SolrMetricProducer.TYPE_ATTR;
+
+import io.opentelemetry.api.common.Attributes;
+import org.apache.solr.cloud.CloudDescriptor;
+import org.apache.solr.common.util.Utils;
+import org.apache.solr.core.CoreDescriptor;
import org.apache.solr.core.SolrCore;
import org.apache.solr.metrics.SolrMetricsContext;
+import org.apache.solr.metrics.otel.OtelUnit;
+import org.apache.solr.metrics.otel.instruments.AttributedLongCounter;
+import org.apache.solr.metrics.otel.instruments.AttributedLongHistogram;
/** Metrics presented for each SolrCore using `crossdc.producer.` path. */
public class ProducerMetrics {
- private final Counter local;
- private final Counter localError;
- private final Counter submitted;
- private final Counter submitError;
- private final Histogram documentSize;
- private final Counter documentTooLarge;
+ private final AttributedLongCounter local;
+ private final AttributedLongCounter localError;
+ private final AttributedLongCounter submitted;
+ private final AttributedLongCounter submitError;
+ private final AttributedLongHistogram documentSize;
+ private final AttributedLongCounter documentTooLarge;
public ProducerMetrics(SolrMetricsContext solrMetricsContext, SolrCore
solrCore) {
+ CoreDescriptor coreDescriptor = solrCore.getCoreDescriptor();
+ CloudDescriptor cloudDescriptor =
+ (coreDescriptor != null) ? coreDescriptor.getCloudDescriptor() : null;
+ var attributesBuilder = Attributes.builder().put(CORE_ATTR,
solrCore.getName());
+ if (cloudDescriptor != null) {
+ attributesBuilder
+ .put(COLLECTION_ATTR, coreDescriptor.getCollectionName())
+ .put(SHARD_ATTR, cloudDescriptor.getShardId())
+ .put(
+ REPLICA_ATTR,
+ Utils.parseMetricsReplicaName(
+ coreDescriptor.getCollectionName(), solrCore.getName()));
Review Comment:
it looks suspicious to parse the replica name out of the core name in a
context where we have access to many Solr internals. CC @HoustonPutman do you
know how to get the replica name here? Would it really be necessary to go look
up the Replica (in cluster state)? How awkward if so
--
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]