contrueCT commented on code in PR #7882:
URL: https://github.com/apache/incubator-seata/pull/7882#discussion_r2678471954


##########
namingserver/src/main/java/org/apache/seata/namingserver/manager/ClusterWatcherManager.java:
##########
@@ -85,8 +93,15 @@ public void onChangeEvent(ClusterChangeEvent event) {
             GROUP_UPDATE_TERM.put(event.getGroup(), event.getTerm());
             // Notifications are made of changes in cluster information
 
-            Optional.ofNullable(WATCHERS.remove(event.getGroup()))
-                    .ifPresent(watchers -> 
watchers.parallelStream().forEach(this::notify));
+            
Optional.ofNullable(WATCHERS.remove(event.getGroup())).ifPresent(watchers -> {
+                watchers.parallelStream().forEach(this::notify);
+                // Increment cluster change push counter
+                if (!watchers.isEmpty()) {
+                    
metricsManager.incrementClusterChangePushCount(event.getGroup());

Review Comment:
   Currently ClusterChangeEvent only contains group and term fields, so I could 
only use group as the tag.
   However, I noticed that in NamingManager.notifyClusterChange(), the 
namespace and clusterName are available when publishing the event. I can extend 
ClusterChangeEvent to include these fields, then pass them to the metrics.



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

Reply via email to