Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4586#discussion_r135764351
  
    --- Diff: 
flink-metrics/flink-metrics-prometheus/src/main/java/org/apache/flink/metrics/prometheus/PrometheusReporter.java
 ---
    @@ -84,21 +84,30 @@ static String replaceInvalidChars(final String input) {
     
        @Override
        public void open(MetricConfig config) {
    -           int port = config.getInteger(ARG_PORT, DEFAULT_PORT);
    -           LOG.info("Using port {}.", port);
    -           prometheusEndpoint = new PrometheusEndpoint(port);
    -           try {
    -                   prometheusEndpoint.start(NanoHTTPD.SOCKET_READ_TIMEOUT, 
true);
    -           } catch (IOException e) {
    -                   final String msg = "Could not start PrometheusEndpoint 
on port " + port;
    -                   LOG.warn(msg, e);
    -                   throw new RuntimeException(msg, e);
    +           String portsConfig = config.getString(ARG_PORT, DEFAULT_PORT);
    +
    +           if (portsConfig != null) {
    --- End diff --
    
    This check isn't needed. If we keep it we should also throw an exception if 
portsConfig is null as otherwise we're hitting an NPE later on since httpServer 
is still null.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to