You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/11/27 03:58:03 UTC

[GitHub] [incubator-ratis] szetszwo opened a new pull request #303: RATIS-1184. Move RaftServerMetrics to org.apache.ratis.server.metrics.

szetszwo opened a new pull request #303:
URL: https://github.com/apache/incubator-ratis/pull/303


   See https://issues.apache.org/jira/browse/RATIS-1184


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

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



[GitHub] [incubator-ratis] runzhiwang commented on a change in pull request #303: RATIS-1184. Move RaftServerMetrics to org.apache.ratis.server.metrics.

Posted by GitBox <gi...@apache.org>.
runzhiwang commented on a change in pull request #303:
URL: https://github.com/apache/incubator-ratis/pull/303#discussion_r531485549



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/metrics/RaftServerMetrics.java
##########
@@ -108,20 +118,18 @@ private RatisMetricRegistry getMetricRegistryForRaftServer(String serverId) {
         RATIS_SERVER_METRICS_DESC));
   }
 
-  private void addRetryCacheMetric(RaftServerImpl raftServer) {
-    registry.gauge(RETRY_CACHE_ENTRY_COUNT_METRIC, () -> () -> raftServer.getRetryCache().size());
-    registry.gauge(RETRY_CACHE_HIT_COUNT_METRIC, () -> () -> raftServer.getRetryCache().stats().hitCount());
-    registry.gauge(RETRY_CACHE_HIT_RATE_METRIC, () -> () -> raftServer.getRetryCache().stats().hitRate());
-    registry.gauge(RETRY_CACHE_MISS_COUNT_METRIC, () -> () -> raftServer.getRetryCache().stats().missCount());
-    registry.gauge(RETRY_CACHE_MISS_RATE_METRIC, () -> () -> raftServer.getRetryCache().stats().missRate());
+  private void addRetryCacheMetric(Supplier<RetryCache> retryCache) {
+    registry.gauge(RETRY_CACHE_ENTRY_COUNT_METRIC, () -> () -> retryCache.get().size());
+    registry.gauge(RETRY_CACHE_HIT_COUNT_METRIC  , () -> () -> retryCache.get().stats().hitCount());
+    registry.gauge(RETRY_CACHE_HIT_RATE_METRIC   , () -> () -> retryCache.get().stats().hitRate());
+    registry.gauge(RETRY_CACHE_MISS_COUNT_METRIC , () -> () -> retryCache.get().stats().missCount());
+    registry.gauge(RETRY_CACHE_MISS_RATE_METRIC  , () -> () -> retryCache.get().stats().missRate());

Review comment:
       The space before "," looks incorrect ?




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

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



[GitHub] [incubator-ratis] szetszwo commented on a change in pull request #303: RATIS-1184. Move RaftServerMetrics to org.apache.ratis.server.metrics.

Posted by GitBox <gi...@apache.org>.
szetszwo commented on a change in pull request #303:
URL: https://github.com/apache/incubator-ratis/pull/303#discussion_r531673547



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/metrics/RaftServerMetrics.java
##########
@@ -108,20 +118,18 @@ private RatisMetricRegistry getMetricRegistryForRaftServer(String serverId) {
         RATIS_SERVER_METRICS_DESC));
   }
 
-  private void addRetryCacheMetric(RaftServerImpl raftServer) {
-    registry.gauge(RETRY_CACHE_ENTRY_COUNT_METRIC, () -> () -> raftServer.getRetryCache().size());
-    registry.gauge(RETRY_CACHE_HIT_COUNT_METRIC, () -> () -> raftServer.getRetryCache().stats().hitCount());
-    registry.gauge(RETRY_CACHE_HIT_RATE_METRIC, () -> () -> raftServer.getRetryCache().stats().hitRate());
-    registry.gauge(RETRY_CACHE_MISS_COUNT_METRIC, () -> () -> raftServer.getRetryCache().stats().missCount());
-    registry.gauge(RETRY_CACHE_MISS_RATE_METRIC, () -> () -> raftServer.getRetryCache().stats().missRate());
+  private void addRetryCacheMetric(Supplier<RetryCache> retryCache) {
+    registry.gauge(RETRY_CACHE_ENTRY_COUNT_METRIC, () -> () -> retryCache.get().size());
+    registry.gauge(RETRY_CACHE_HIT_COUNT_METRIC  , () -> () -> retryCache.get().stats().hitCount());
+    registry.gauge(RETRY_CACHE_HIT_RATE_METRIC   , () -> () -> retryCache.get().stats().hitRate());
+    registry.gauge(RETRY_CACHE_MISS_COUNT_METRIC , () -> () -> retryCache.get().stats().missCount());
+    registry.gauge(RETRY_CACHE_MISS_RATE_METRIC  , () -> () -> retryCache.get().stats().missRate());

Review comment:
       No, just using vertical alignment (https://en.wikipedia.org/wiki/Programming_style#Vertical_alignment).  It is easier to read for situation like this.  Intellij supports a similar feature for javadoc.
   <img width="1115" alt="image" src="https://user-images.githubusercontent.com/907380/100466112-58d9c480-310b-11eb-94b1-66e2b563c594.png">
   




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

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



[GitHub] [incubator-ratis] runzhiwang merged pull request #303: RATIS-1184. Move RaftServerMetrics to org.apache.ratis.server.metrics.

Posted by GitBox <gi...@apache.org>.
runzhiwang merged pull request #303:
URL: https://github.com/apache/incubator-ratis/pull/303


   


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

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