kevinrr888 commented on code in PR #5798: URL: https://github.com/apache/accumulo/pull/5798#discussion_r2301593119
########## core/src/main/java/org/apache/accumulo/core/fate/FateExecutorMetrics.java: ########## @@ -0,0 +1,101 @@ +/* + * 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.core.fate; + +import java.util.Set; +import java.util.concurrent.TransferQueue; + +import org.apache.accumulo.core.metrics.Metric; +import org.apache.accumulo.core.metrics.MetricsProducer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.micrometer.core.instrument.Gauge; +import io.micrometer.core.instrument.MeterRegistry; + +public class FateExecutorMetrics<T> implements MetricsProducer { + private static final Logger log = LoggerFactory.getLogger(FateExecutorMetrics.class.getName()); + private final FateInstanceType type; + private final String operatesOn; + private final Set<FateExecutor<T>.TransactionRunner> runningTxRunners; + private final TransferQueue<FateId> workQueue; + private MeterRegistry registry; + public static final String INSTANCE_TYPE_TAG_KEY = "instanceType"; + public static final String OPS_ASSIGNED_TAG_KEY = "ops.assigned"; + + protected FateExecutorMetrics(FateInstanceType type, String operatesOn, + Set<FateExecutor<T>.TransactionRunner> runningTxRunners, TransferQueue<FateId> workQueue) { + this.type = type; + this.operatesOn = operatesOn; + this.runningTxRunners = runningTxRunners; + this.workQueue = workQueue; + } + + @Override + public void registerMetrics(MeterRegistry registry) { + Gauge.builder(Metric.FATE_OPS_THREADS_TOTAL.getName(), runningTxRunners::size) + .description(Metric.FATE_OPS_THREADS_TOTAL.getDescription()) + .tag(INSTANCE_TYPE_TAG_KEY, type.name().toLowerCase()).tag(OPS_ASSIGNED_TAG_KEY, operatesOn) Review Comment: I'm not sure if shortening them that way would be useful as often times the ops assigned won't be associated with any particular regex pattern. It might help in the rare case they are. I also think this would also add a lot of complexity (finding shared patterns of ops in one pool but make sure those shared patterns don't include ops assigned to other pools). I also think this shortening would make it harder for users to read. E.g., "TABLE_C*" means TABLE_CANCEL_COMPACT, TABLE_CLONE, TABLE_COMPACT, TABLE_CREATE, but that's hard to figure out. Looking into Prometheus, looks like there is no tag length limit. It does seem like several tools do limit tags to 100, 200, 256, etc. chars which would be a problem for this tag... Not sure of a good way to go about this if we want this to be shorter. -- 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: notifications-unsubscr...@accumulo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org