-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Prometheus server crash on listening to already used port #1986
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1986 +/- ##
==========================================
+ Coverage 87.11% 87.13% +0.03%
==========================================
Files 166 166
Lines 4597 4597
==========================================
+ Hits 4004 4005 +1
+ Misses 593 592 -1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, setting the exporter to shutdown looks like the best solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for the fix :)
Fixes #1903
Changes
Please provide a brief description of the changes here.
It's difficult to add unit-test to simulate port usage. So tested changes as below:
Step 1: Start a http server at particular port (say 8000):
$python3 -m http.server --cgi 8000 Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
Step 2: Try running Prometheus example to invoke Prometheus exporter on this used port 8000:
This fails gracefully.
Step 3: Try running Prometheus example to invoke Prometheus exporter on some unused port (say 8001):
This is successful.
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes