[
https://issues.apache.org/jira/browse/FLINK-36240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17881865#comment-17881865
]
Arkadiusz Dankiewicz edited comment on FLINK-36240 at 9/15/24 6:08 PM:
-----------------------------------------------------------------------
Thanks for the assignment. I have just created the pull request with an
additional section for discussion as I am curious about alternative solutions.
Looking forward to your response.
was (Author: JIRAUSER301246):
Thanks for the task. I have just created the pull request with an additional
section for discussion as I am curious about alternative solutions. Looking
forward to your response.
> 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
>
> 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)