[ 
https://issues.apache.org/jira/browse/FLINK-36240?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ferenc Csaky resolved FLINK-36240.
----------------------------------
    Fix Version/s: 2.0-preview
       Resolution: Fixed

[20e9826|https://github.com/apache/flink/commit/20e9826f7701f91eedfbf599afb33822128145e6]
 in master

> Incorrect Port display in the PrometheusReporter constructor
> ------------------------------------------------------------
>
>                 Key: FLINK-36240
>                 URL: https://issues.apache.org/jira/browse/FLINK-36240
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Metrics
>    Affects Versions: 1.17.2, 1.18.1, 1.20.0, 1.19.1
>            Reporter: Arkadiusz Dankiewicz
>            Assignee: Arkadiusz Dankiewicz
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 2.0-preview
>
>
> In Flink v1.17 I found a problem with the PrometheusReporter constructor that 
> is still there. When the {{PrometheusReporter}} fails to start on any 
> configured port, the error message does not correctly display the configured 
> ports. Instead of printing the actual port numbers, the error message outputs 
> the {{{}Iterator{}}}'s toString representation, which is not helpful for 
> debugging.
> The relevant code snippet is as follows:
> {code:java}
>     PrometheusReporter(Iterator<Integer> ports) {
>         while (ports.hasNext()) {
>             port = ports.next();
>             try {
>                 httpServer = new HTTPServer(new InetSocketAddress(port), 
> this.registry);
>                 log.info("Started PrometheusReporter HTTP server on port 
> {}.", port);
>                 break;
>             } catch (IOException ioe) { // assume port conflict
>                 log.debug("Could not start PrometheusReporter HTTP server on 
> port {}.", port, ioe);
>             }
>         }
>         if (httpServer == null) {
>             throw new RuntimeException(
>                     "Could not start PrometheusReporter HTTP server on any 
> configured port. Ports: "
>                             + ports);
>         }
>     } {code}
> The RuntimeException logs the Iterator object reference instead of the actual 
> list of port numbers: 
> {code:java}
> Could not start PrometheusReporter HTTP server on any configured port. Ports: 
> org.apache.flink.util.UnionIterator@67065fd3{code}
> To make the error message more informative, it would be better to log the 
> actual port numbers by collecting them into a list or converting the 
> {{Iterator}} to a string representation of the configured ports. This change 
> will significantly improve the debugging process for port-related issues in 
> the PrometheusReporter.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to