-
Notifications
You must be signed in to change notification settings - Fork 480
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
Log shutdown gracefully #428
Conversation
Signed-off-by: mjip <marie.payne@hotmail.ca>
0a1e274
to
25de04b
Compare
Thanks for your contribution. Unfortunately, this doesn't work as intended. The way the graceful shotdown is implemented right now is to close the socket. After that, If you try out and run the code with your PR, then hit CTRL-C, you will still see the error-level log message. |
Signed-off-by: mjip <marie.payne@hotmail.ca>
Thanks for picking that up! I added a check on the error message- unfortunately, the maintainers of the |
Hmm, I think relying on a certain substring in the error message is very brittle. I'm not really an expert when it comes to HTTP serving in Go, but I assume the real problem is that we bluntly call Line 257 in 079d8d8
I have now done a bit of research, and my impression is that we should store a pointer to the Line 198 in 079d8d8
Then, instead of calling Lines 200 to 203 in 079d8d8
The reason why things were done in this weird way is that it is really old code. The Does that make any sense? |
Signed-off-by: mjip <marie.payne@hotmail.ca>
Your suggestion made sense to me, and I prefer it as well. Let me know if this is what you had in mind. |
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.
Code looks perfect. Thank you very much for removing this old wart.
I just have a tiny bit of nitpicking about a doc comment.
main.go
Outdated
go shutdownServerOnQuit(server, quitCh, logger) | ||
err = web.Serve(l, server, *webConfig, logger) | ||
|
||
// In the case of a shutdown, log gracefully |
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.
Nit: End sentence with a period.
And, even more nitpicking, "log gracefully" might not really nail it. How about "In the case of a graceful shutdown, do not log the error."
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.
Apologies- I did read the Go Code Review Comments document, but forgot about that convention. This has been changed.
Signed-off-by: mjip <marie.payne@hotmail.ca>
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.
Looks perfect. Thank you very much.
Hello dear,sorry for desturbing you. |
@yejumihoutao There hasn't been a lot happening since the last release. But it is quite long ago (1.4.1 happened in May), so I'll cut 1.4.2. Please review #432. |
@beorn7 |
* master: (30 commits) Update common Prometheus files Update common Prometheus files Update common Prometheus files Bump Go version to 1.17 Update common Prometheus files Update common Prometheus files Update common Prometheus files Cut v1.4.2 Update dependencies Update build tags to new style Log shutdown gracefully (prometheus#428) Simplify and update the issue template Update common Prometheus files go.mod: Update dependencies Replace go-kit/kit with go-kit/log Update common Prometheus files Cut v1.4.1 Fix spelling and comment Fix spelling in test Fix issue where labels aren't persisted when draining ...
Closes #427
@beorn7