Fix Prometheus server crash on listening to already used port#1986
Merged
lalitb merged 12 commits intoopen-telemetry:mainfrom Feb 16, 2023
Merged
Fix Prometheus server crash on listening to already used port#1986lalitb merged 12 commits intoopen-telemetry:mainfrom
lalitb merged 12 commits intoopen-telemetry:mainfrom
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
|
marcalff
approved these changes
Feb 15, 2023
Member
marcalff
left a comment
There was a problem hiding this comment.
LGTM, setting the exporter to shutdown looks like the best solution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.mdupdated for non-trivial changes