justinrsweeney commented on code in PR #948: URL: https://github.com/apache/solr/pull/948#discussion_r930429630
########## solr/core/src/java/org/apache/solr/metrics/DelegateRegistryCounter.java: ########## @@ -0,0 +1,68 @@ +/* + * 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; + +import com.codahale.metrics.Counter; + +public class DelegateRegistryCounter extends Counter { + + private final Counter primaryCounter; Review Comment: Sort of, but the actual creation of a Counter is done here: https://github.com/justinrsweeney/solr/blob/5d17a4865c7c46f33fb6fc08b0d57b69937dfffe/solr/core/src/java/org/apache/solr/metrics/SolrMetricManager.java#L686 which uses a MetricSupplier that is configured. The SolrDelegateRegistryMetricsContext is really responsible for being aware of a delegate registry and does create a DelegateRegistryCounter in those cases. In order to get to a case where `this` was the primary counter and we could and drop the primaryCounter variable, I think I'd have to wrap or extend SolrMetricManager and change how MetricSupplier is done I think. It is difficult to achieve that while also making this limited to only request handlers which I think we want since the SolrMetricManager is created at core loading time. Definitely open to trying to make it work if you see a better path, to me it feels like it is going to create more challenges than it'll solve. While I agree the weight of objects matters, I don't think the DelegateRegistryCounter is not adding much weight beyond the Counter objects it wraps. -- 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]
