slfan1989 commented on code in PR #1621:
URL: https://github.com/apache/ratis/pull/1621#discussion_r4207169581
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/LeaderStateImpl.java:
##########
@@ -483,7 +485,9 @@ CompletableFuture<Void> stop() {
replyFlusher.stop();
}
logAppenderMetrics.unregister();
- raftServerMetrics.unregister();
+ synchronized (followerMetricsLock) {
+ raftServerMetrics.clearFollowerHeartbeatMetrics();
Review Comment:
Thanks @amaliujia for the question!
`getRegistry()` and the global registry manager reference the same registry
instance, so removing the heartbeat gauges also removes them from the global
view.
We keep the registry itself registered because the server still uses the
remaining metrics after stepping down. The entire registry is unregistered when
the server closes. The updated test verifies this shared instance with
`assertSame(...)`.
--
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]