jerqi commented on code in PR #150:
URL: https://github.com/apache/incubator-uniffle/pull/150#discussion_r946649348
##########
common/src/main/java/org/apache/uniffle/common/metrics/GRPCMetrics.java:
##########
@@ -25,6 +25,13 @@
import io.prometheus.client.Gauge;
public abstract class GRPCMetrics {
+ // Grpc server internal executor metrics
+ public static final String GRPC_SERVER_EXECUTOR_ACTIVE_THREADS_TAG =
"grpcServerExecutorActiveThreads";
Review Comment:
Why does our name contain `TAG`?
##########
common/src/main/java/org/apache/uniffle/common/rpc/GrpcServer.java:
##########
@@ -76,6 +81,41 @@ public GrpcServer(RssBaseConf conf, BindableService service,
GRPCMetrics grpcMet
}
}
+ public static class GrpcThreadPoolExecutor extends ThreadPoolExecutor {
+ private final GRPCMetrics grpcMetrics;
+ private final AtomicLong activeThreadSize = new AtomicLong(0L);
+
+ public GrpcThreadPoolExecutor(
+ int corePoolSize,
+ int maximumPoolSize,
+ long keepAliveTime,
+ TimeUnit unit,
+ BlockingQueue<Runnable> workQueue,
+ ThreadFactory threadFactory,
+ GRPCMetrics grpcMetrics) {
+ super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue,
threadFactory);
+ this.grpcMetrics = grpcMetrics;
+ }
+
+ @Override
+ protected void beforeExecute(Thread t, Runnable r) {
+ grpcMetrics.setGauge(GRPCMetrics.GRPC_SERVER_EXECUTOR_ACTIVE_THREADS_TAG,
+ activeThreadSize.incrementAndGet());
+
grpcMetrics.setGauge(GRPCMetrics.GRPC_SERVER_EXECUTOR_BLOCKING_QUEUE_SIZE_TAG,
+ getQueue().size());
+ super.beforeExecute(t, r);
+ }
+
+ @Override
+ protected void afterExecute(Runnable r, Throwable t) {
Review Comment:
Will the method be called if an exception occurs.
--
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]