tillrohrmann commented on a change in pull request #10466:
[FLINK-15110][metrics] Support variable exclusion
URL: https://github.com/apache/flink/pull/10466#discussion_r354940915
##########
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:
nit: One could phrase the assertion a bit nicer:
`assertThat(group2.getAllVariables(-1,
Collections.singleton(ScopeFormat.SCOPE_HOST)), isMapWithSize(0));` with
`isMapWithSize` according to https://stackoverflow.com/a/36087146/4815083
----------------------------------------------------------------
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