enixon commented on a change in pull request #854: ZOOKEEPER-3143 Pluggable 
metrics system for ZooKeeper - Data Collection on Server
URL: https://github.com/apache/zookeeper/pull/854#discussion_r271876021
 
 

 ##########
 File path: 
zookeeper-server/src/main/java/org/apache/zookeeper/server/command/MonitorCommand.java
 ##########
 @@ -80,6 +81,20 @@ public void commandRun() {
             print("max_proposal_size", 
leader.getProposalStats().getMaxBufferSize());
             print("min_proposal_size", 
leader.getProposalStats().getMinBufferSize());
         }
+
+        ServerMetrics.getMetrics()
+                    .getMetricsProvider()
+                    .dump(
+                    (metric, value) -> {
+                        if (value instanceof Long
+                                || value instanceof Integer) {
+                            print(metric, ((Number) value).longValue());
+                        } else if (value instanceof Number) {
+                            print(metric, ((Number) value).doubleValue());     
                   
+                        } else {
+                            print(metric, value + "");
 
 Review comment:
   Is the `+ ""` an alternative form of `.toString()`? If so, I'd prefer the 
latter.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to