tillrohrmann commented on a change in pull request #10466: [FLINK-15110][metrics] Support variable exclusion URL: https://github.com/apache/flink/pull/10466#discussion_r355960399
########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroupTest.java ########## @@ -71,6 +76,17 @@ protected String getGroupName(CharacterFilter filter) { registry.shutdown().get(); } + @Test + public void testGetAllVariablesWithExclusions() { + MetricRegistry registry = NoOpMetricRegistry.INSTANCE; + + AbstractMetricGroup<?> group1 = new ProcessMetricGroup(registry, "host"); + assertThat(group1.getAllVariables(), IsMapContaining.hasKey(ScopeFormat.SCOPE_HOST)); + + AbstractMetricGroup<?> group2 = new ProcessMetricGroup(registry, "host"); + assertEquals(group2.getAllVariables(-1, Collections.singleton(ScopeFormat.SCOPE_HOST)).size(), 0); Review comment: Why not introducing `isMapWithSize` as a utility? I guess there are plenty of other places where such a utility would be helpful. Once we upgrade Hamcrest one could easily replace it. Now it will be super hard to find all locations where it would be applicable. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services