dlmarion commented on code in PR #4461: URL: https://github.com/apache/accumulo/pull/4461#discussion_r1579338982
########## server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java: ########## @@ -0,0 +1,70 @@ +/* + * 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 + * + * https://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.accumulo.tserver; + +import java.util.List; + +import org.apache.accumulo.core.dataImpl.KeyExtent; +import org.apache.accumulo.core.metadata.schema.TabletMetadata; +import org.apache.accumulo.core.metrics.MetricsProducer; + +import com.github.benmanes.caffeine.cache.LoadingCache; + +import io.micrometer.core.instrument.Counter; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.Tag; +import io.micrometer.core.instrument.Timer; +import io.micrometer.core.instrument.binder.cache.CaffeineCacheMetrics; + +public class ScanServerMetrics implements MetricsProducer { + + private final String resourceGroup; + private Timer reservationTimer; + private Counter busyCounter; + + private final LoadingCache<KeyExtent,TabletMetadata> tabletMetadataCache; + + public ScanServerMetrics(final LoadingCache<KeyExtent,TabletMetadata> tabletMetadataCache, + String resourceGroup) { + this.tabletMetadataCache = tabletMetadataCache; + this.resourceGroup = resourceGroup; + } + + @Override + public void registerMetrics(MeterRegistry registry) { + reservationTimer = Timer.builder(MetricsProducer.METRICS_SSERVER_REGISTRATION_TIMER) + .description("Time to reserve a tablets files for scan") + .tag("resource.group", resourceGroup).register(registry); Review Comment: I think the resource group is part of the common tags in elasticity, or it should be. Something to be aware of on the merge. ########## core/src/main/java/org/apache/accumulo/core/metrics/MetricsProducer.java: ########## @@ -638,6 +660,11 @@ public interface MetricsProducer { String METRICS_TSERVER_SCAN_RESULTS_BYTES = METRICS_TSERVER_PREFIX + "scan.results.bytes"; String METRICS_TSERVER_SCANNED_ENTRIES = METRICS_TSERVER_PREFIX + "scan.scanned.entries"; + String METRICS_SSERVER_PREFIX = "accumulo.sserver."; + String METRICS_SSERVER_REGISTRATION_TIMER = METRICS_SSERVER_PREFIX + "registration.timer"; + String METRICS_SSERVER_BUSY_COUNTER = METRICS_SSERVER_PREFIX + "busy.count"; + String METRICS_SSERVER_TABLET_METADATA_CACHE = METRICS_SSERVER_PREFIX + "tablet.metadata.cache"; Review Comment: There are already scan related metrics, METRICS_SCAN_BUSY_TIMEOUT for example, that don't include the process name in the metric name. The process name is, or should be, part of the common tags which allow for metric reuse. Suggest using this pattern where possible. ########## server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java: ########## @@ -0,0 +1,70 @@ +/* + * 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 + * + * https://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.accumulo.tserver; + +import java.util.List; + +import org.apache.accumulo.core.dataImpl.KeyExtent; +import org.apache.accumulo.core.metadata.schema.TabletMetadata; +import org.apache.accumulo.core.metrics.MetricsProducer; + +import com.github.benmanes.caffeine.cache.LoadingCache; + +import io.micrometer.core.instrument.Counter; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.Tag; +import io.micrometer.core.instrument.Timer; +import io.micrometer.core.instrument.binder.cache.CaffeineCacheMetrics; + +public class ScanServerMetrics implements MetricsProducer { + + private final String resourceGroup; + private Timer reservationTimer; + private Counter busyCounter; + + private final LoadingCache<KeyExtent,TabletMetadata> tabletMetadataCache; + + public ScanServerMetrics(final LoadingCache<KeyExtent,TabletMetadata> tabletMetadataCache, + String resourceGroup) { + this.tabletMetadataCache = tabletMetadataCache; + this.resourceGroup = resourceGroup; + } + + @Override + public void registerMetrics(MeterRegistry registry) { + reservationTimer = Timer.builder(MetricsProducer.METRICS_SSERVER_REGISTRATION_TIMER) + .description("Time to reserve a tablets files for scan") + .tag("resource.group", resourceGroup).register(registry); + // TODO this counter is a duplicate, already a metrics for this below the scan server... use + // that instead, but look into renaming existing one to indicate scan server + busyCounter = Counter.builder(MetricsProducer.METRICS_SSERVER_BUSY_COUNTER) Review Comment: The process name in the common tags should differentiate between tserver and sserver. -- 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]
