Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-8033 JDK 9 support
  3. FLINK-11413

Reporter filtering using "metrics.reporters" broken on Java 9+

    XMLWordPrintableJSON

    Details

      Description

      When using java 11, "metrics.reporters" configuration has to be provided for reporters to be taken into account.
       
      The desired behavior:
      The MetricRegistryConfiguration looks for a conf like "metrics.reporters = foo,bar", if not found: all reporters that could be found in the configuration will be started.
       
      In the code is it done bySet<String> includedReporters = reporterListPattern.splitAsStream(includedReportersString).collect(Collectors.toSet());
      https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java#L134
       Definition of splitAsStream: If this pattern does not match any subsequence of the input then the resulting stream has just one element, namely the input sequence in string form.
      It means  reporterListPattern.splitAsStream("") should return "" and so includedReporters should have size 1 with "" as unique element

      However there is a misbehavior in some version of java 8, it does return empty stream.
      But working with java 11, the further code does not work: if (includedReporters.isEmpty() || includedReporters.contains(reporterName))
      https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java#L145

      I would suggest to filter empty string:
      Set<String> includedReporters = reporterListPattern.splitAsStream(includedReportersString).filter(s -> !s.isEmpty()).collect(Collectors.toSet());

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mbonneviot Matthieu Bonneviot
                Reporter:
                mbonneviot Matthieu Bonneviot
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m