-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
When running under systemd, send notifications about server startup, shutdown, and config reload #11517
Conversation
…shutdown, and config reload
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.
requesting changes because i don't think the log in question is accurate if err != nil
command/server.go
Outdated
if sent { | ||
c.logger.Debug("sent systemd notification", "notification", status) | ||
} else { | ||
c.logger.Debug("would have sent systemd notification (systemd not present)", "notification", status) |
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.
these are likely very infrequent, but why do we want this log?
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.
also i think this can be inaccurate if err != nil
- I looked at SdNotify
and it'll return false
with a non-nil error so this log might be confusing?
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.
The logging was partially to assist implementation, but could also help people debugging since it requires correct configuration in systemd to work as well. You're right that the if sent/else block should only happen if err is nil.
This is a noop on systems without systemd, and when not spawned by systemd. Note that "Type=notify" must be specified in the systemd service definition in order for systemd to spawn a notification socket and set the corresponding environment variable.