You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "XComp (via GitHub)" <gi...@apache.org> on 2023/01/30 10:03:20 UTC

[GitHub] [flink] XComp commented on a diff in pull request #21762: [FLINK-30796][metrics][slf4j] (Partially) skip metrics report

XComp commented on code in PR #21762:
URL: https://github.com/apache/flink/pull/21762#discussion_r1090407495


##########
flink-metrics/flink-metrics-slf4j/src/test/java/org/apache/flink/metrics/slf4j/Slf4jReporterTest.java:
##########
@@ -57,10 +58,75 @@ static void setUp() {
                 TestMetricGroup.newBuilder()
                         .setMetricIdentifierFunction((s, characterFilter) -> SCOPE + delimiter + s)
                         .build();
+    }
+
+    @BeforeEach
+    void setUpReporter() {
         reporter = new Slf4jReporter();
         reporter.open(new MetricConfig());
     }
 
+    @Test
+    void testSkipOnNoMetrics() {
+        reporter.report();
+
+        assertThat(testLoggerResource.getMessages())
+                .noneMatch(logOutput -> logOutput.contains("Starting metrics report"))
+                .anyMatch(logOutput -> logOutput.contains("Skipping metrics report"));
+    }
+
+    @Test
+    void testSkipCountersIfNoCounterRegistered() {

Review Comment:
   ```suggestion
       void testOnlyCounterRegistered() {
   ```
   Isn't the test method name misleading? It's doing the opposite of what the name implies. 
   This applies to the other test methods below.



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

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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