[ https://issues.apache.org/jira/browse/FLINK-11413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16762893#comment-16762893 ]
Matthieu Bonneviot commented on FLINK-11413: -------------------------------------------- [~Zentol] I was wondering if I should fix also a behavior of the config java 8: I consider 3 uses cases for reporter configuration: # provide several metrics.reporter.my_reporter_xxx.class -> all reporters will be started # provide several metrics.reporter.my_reporter_xxx.class + provide metrics.reporters=sublist of my configured reporter -> only the intersection between my configured reporter and metrics.reporters list will be started # provide several metrics.reporter.my_reporter_xxx.class + provide metrics.reporters = empty list -> currently it is like first case, all reporters will be started I would think that if metrics.reporters = empty list I don't want any of my reporter to be instantiated But that will change the current behavior so I prefer to refer to you before doing this change. (I don't think it changes the documentation) > Reporter filtering using "metrics.reporters" broken on Java 9+ > -------------------------------------------------------------- > > Key: FLINK-11413 > URL: https://issues.apache.org/jira/browse/FLINK-11413 > Project: Flink > Issue Type: Sub-task > Components: Configuration, Metrics > Affects Versions: 1.6.3, 1.7.1 > Reporter: Matthieu Bonneviot > Assignee: Matthieu Bonneviot > Priority: Minor > Fix For: 1.8.0 > > > 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()); -- This message was sent by Atlassian JIRA (v7.6.3#76005)