You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2022/12/08 10:58:47 UTC

[GitHub] [ratis] qian0817 commented on pull request #796: RATIS-1757: Missing some metrics for listener.

qian0817 commented on PR #796:
URL: https://github.com/apache/ratis/pull/796#issuecomment-1342532896

   > Thanks a lot for working on this, @qian0817 !
   > 
   > +1 the change looks good.
   > 
   > Just found that `RaftServerMetricsImpl.followerLastHeartbeatElapsedTimeMap` should use a `ConcurrentHashMap`. Could you also change it?
   > 
   > ```java
   > +++ b/ratis-server/src/main/java/org/apache/ratis/server/metrics/RaftServerMetricsImpl.java
   > @@ -20,7 +20,6 @@ package org.apache.ratis.server.metrics;
   >  
   >  import java.util.Optional;
   >  import java.util.concurrent.ConcurrentHashMap;
   > -import java.util.HashMap;
   >  import java.util.Map;
   >  import java.util.function.Function;
   >  import java.util.function.Supplier;
   > @@ -98,7 +97,7 @@ public final class RaftServerMetricsImpl extends RatisMetrics implements RaftSer
   >        = newHeartbeatTimer(FOLLOWER_APPEND_ENTRIES_LATENCY);
   >  
   >    /** Follower Id -> heartbeat elapsed */
   > -  private final Map<RaftPeerId, Long> followerLastHeartbeatElapsedTimeMap = new HashMap<>();
   > +  private final Map<RaftPeerId, Long> followerLastHeartbeatElapsedTimeMap = new ConcurrentHashMap<>();
   >    private final Supplier<Function<RaftPeerId, CommitInfoProto>> commitInfoCache;
   >  
   >    /** id -> metric */
   > ```
   
   fix.


-- 
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: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org