-
Notifications
You must be signed in to change notification settings - Fork 795
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(@opentelemetry/exporter-prometheus): unref prometheus server to prevent process running indefinitely #2558
fix(@opentelemetry/exporter-prometheus): unref prometheus server to prevent process running indefinitely #2558
Conversation
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.
Good catch
If its easy a test would be nice. If not, then this is such a small change its unlikely to be a problem. |
Codecov Report
@@ Coverage Diff @@
## main #2558 +/- ##
==========================================
+ Coverage 93.05% 93.08% +0.02%
==========================================
Files 140 58 -82
Lines 5172 1894 -3278
Branches 1111 408 -703
==========================================
- Hits 4813 1763 -3050
+ Misses 359 131 -228
|
We've got this monkeypatched it in our environment, so I'm not in a rush to get this in upstream -- I can take a look at adding tests after hours. Would you mock createServer and just test for unref being called? Usually I prefer the behavioral tests, but I'm not sure offhand how I'd safely test for the reference count not increasing / exit isn't hung. |
I can't see anywhere in the docs to check if a socket is unref'd so I guess the only way to do it would be with a mock |
took a stab at the test |
e07925e
to
fbaf06a
Compare
This branch is out of date and I don't have permission to update your branch so I can't merge it. Please update the branch and if you give maintainers permission to push to the branch that makes it much easier for us. |
3b4a140
to
93c9d49
Compare
@dyladan I've updated, but to be honest, I'm not entirely sure how to give you access -- looking into that now. Would you consider adding a link to those instructions to the CONTRIBUTING.md doc if I can find some? |
Yeah it should be a checkbox when you create the PR that says something along the lines of "allow maintainers to push changes to the branch" Not sure how its done after the fact but I know its possible. |
^suggests it's possible, but I don't see that option at all 😕 |
^suggests it's possible, but I don't see that option at all 😕 |
I can recreate it if that's going to be easier |
As far as I know this works only for personal forks but not for forks owned by an organisation. |
Oh I didn't see it was an org fork. Tests are still failing. |
…revent process running indefinitely Adds a test case as well, but, unfortunately, just that the server is unrefed. Not immediately clear how we could test based on open handles or reference counting to get at the behavior over the specific implementation.
93c9d49
to
4fc5b3b
Compare
Ah, good to know! I can open another PR to add instructions / caveats to the CONTRIBUTING.md |
tests should be passing now, ran the full suite locally this time |
Which problem is this PR solving?
Prometheus exporter is holding the process open for scripts that are meant to exit.
Short description of the changes
Unrefs the prometheus exporter to allow the process to exit.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Run in our production environment, with a server that was purposely failing to boot -- something like:
Previously, prometheus would hold the process open. With this change, the process exits as expected.