GitHub user zentol opened a pull request: https://github.com/apache/flink/pull/5473
[FLINK-8621][prometheus][tests] Remove endpointIsUnavailableAfterReporterIsClosed() ## What is the purpose of the change This PR removes an unstable test for the PrometheusReporter. The test verified that the metrics could no longer be polled when the reporter was shutdown, however if any other process were to start a server on the same port (which is free after the reporter shutdown) the test would fail. We could theoretically check in that case that it wasn't our reporter that responded, but that's a bit tricky to do with how the reporter currently works (singleton registry). This PR also contains 2 minor changes: * one commit adds a comment to the prometheus reporter to better reflect how the `HTTPServer` is used * one commit adds a utility port-range generator to prevent port-conflicts caused by copy&pasting You can merge this pull request into a Git repository by running: $ git pull https://github.com/zentol/flink 8621 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/5473.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #5473 ---- commit 53fa2376ddd1e47844ade0e74d27f5cd473b9816 Author: zentol <chesnay@...> Date: 2018-02-13T09:31:31Z [FLINK-8621][prometheus][tests] Remove endpointIsUnavailableAfterReporterIsClosed() The test is inherently unstable as it will always fail if any other server is started on the port between the closing of the reporter and the polling of metrics. commit 41097c14074adb91506ff574b10340da924176a3 Author: zentol <chesnay@...> Date: 2018-02-13T09:33:03Z [hotfix][prometheus] Document internal usage of CollectorRegistry.defaultRegistry It appeared as if the HTTPServer wasn't actually doing anything, but it internally accessed the singleton registry that we also access to register metrics. commit 25c04b965bfe6cdae889932bb3bc0c7913c718e3 Author: zentol <chesnay@...> Date: 2018-02-13T09:33:31Z [hotfix][prometheus][tests] Add utility for generating port ranges ---- ---