wuchong commented on code in PR #1466:
URL: https://github.com/apache/fluss/pull/1466#discussion_r2250718717


##########
fluss-server/src/main/java/com/alibaba/fluss/server/coordinator/event/CoordinatorEventManager.java:
##########
@@ -53,7 +58,10 @@ public final class CoordinatorEventManager implements 
EventManager {
     private final Lock putLock = new ReentrantLock();
 
     // metrics
-    private Histogram eventProcessingTime;
+    private final Map<Class<? extends CoordinatorEvent>, Histogram> 
eventProcessTimeByType =
+            MapUtils.newConcurrentHashMap();
+    private final Map<Class<? extends CoordinatorEvent>, Meter> 
eventEnqueueRateByType =
+            MapUtils.newConcurrentHashMap();

Review Comment:
   I think both of them can be declared as `HashMap`, because 
`eventProcessTimeByType` is accessed in the single-thread 
`CoordinatorEventThread`, and `eventEnqueueRateByType` is accessed in the 
`putLock` protection. 



##########
fluss-server/src/main/java/com/alibaba/fluss/server/coordinator/event/CoordinatorEventManager.java:
##########
@@ -121,6 +126,33 @@ public void clearAndPut(CoordinatorEvent event) {
                 });
     }
 
+    private Histogram getOrCreateEventProcessTimeHistogram(
+            Class<? extends CoordinatorEvent> eventType) {
+        return eventProcessTimeByType.computeIfAbsent(
+                eventType,
+                type -> {
+                    String eventTypeName = type.getSimpleName();
+                    MetricGroup eventTypeGroup =
+                            coordinatorMetricGroup.addGroup("event_type", 
eventTypeName);

Review Comment:
   Instead of using `addGroup`, I'm thinking that could we use `variables` 
here? Then we can use variables to filter or combine metrics for different 
event types. 



-- 
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]

Reply via email to