zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] eolivelli commented on a change in pull request #854: ZOOKEEPER-3143 Pluggable metrics system for ZooKeeper - Data Collection on Server
Date Thu, 21 Mar 2019 18:39:47 GMT
eolivelli 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_r267904684
 
 

 ##########
 File path: zookeeper-server/src/test/java/org/apache/zookeeper/server/admin/CommandsTest.java
 ##########
 @@ -193,8 +193,15 @@ public void testMonitor() throws IOException, InterruptedException {
                 new Field("global_sessions", Long.class),
                 new Field("local_sessions", Long.class),
                 new Field("connection_drop_probability", Double.class)
-        ));
-        for (String metric : ServerMetrics.getAllValues().keySet()) {
+        ));        
+        Map<String, Object> metrics = new HashMap<>();
+        ServerMetrics
+                .getMetrics()
+                .getMetricsProvider()
+                .dump( (metric, value)-> {
+                    metrics.put(metric, value);
+                });
+        for (String metric : metrics.keySet()) {
 
 Review comment:
   @lvfangmin
   
   Now we are using your default implementation even in tests.
   I think a better approach for the mid term  future will be to create a TestMetricsProvider
which gives access to its internals and so it is more useful for mocks and for advanced unit
testing

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


With regards,
Apache Git Services

Mime
View raw message