-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add systemd socket listener activation #95
Add systemd socket listener activation #95
Conversation
Signed-off-by: Perry Naseck <[email protected]>
It sounds like we might need to change the tls config in kingpin flags to be a struct and add a flag for this, then pass it to ListenAndServe and do the right thing here. The flag should be optional as we don't want it e.g. in Prometheus and non-linux systems. |
It would be nice if this was integrated into the web One thing I was thinking about here is we currently only support one |
I see, so allow for multiple |
Systemd can also provide multiple activated sockets (of which I am currently erroring if there are multiple), so that would play very nicely into this. |
I took a try at it, but I think I need some guidance with how you would like this to work to support multiple sockets. Please forgive any incorrect assumptions; I am still quite new to Go. It seems that |
Ah, ok this will require proper concurrency. I will keep reading and experimenting and hopefully end up at a pull, but this is definitely outside my current skill-level. Anyone who stumbles upon this pull in the meantime should please feel free to contribute it themselves and I can rebase and incorporate the systemd activation part. |
Could a simple unix socker approach work too or do we need to be systemd specific? |
The difficulty seems to be with having multiple HTTP server instances, not the listeners. I am making progress and should hopefully have something to test next week. |
785aea2
to
45db5e5
Compare
OK! This is now working for multiple systemd activated sockets. It uses the existing But adding that function doesn't really fit well into the current way exporters use the toolkit. The current way seems to be:
My proposal would be to:
This would be a breaking change, but it would ensure that all exporters start this part the same way and that any future changes or features would not introduce breaking changes to the individual exporter code. |
@roidelapluie @SuperQ ping, please provide feedback with what you prefer for implementing the required options. |
if we have a ListenAndServAll, then we don't need to break existing setups. It is acceptable to me to change what https://github.com/prometheus/exporter-toolkit/blob/master/web/kingpinflag/flag.go returns. It can return a pointer to a struct. |
Great, I will try this out this coming week. |
f52477c
to
86d5aa8
Compare
Hello! I have completed the changes. Please let me know if this looks good or if I should make any adjustements. I have implemented:
I will push a working example of |
Signed-off-by: Perry Naseck <[email protected]>
…ystemd listeners, move listener flags implementation from exporter to toolkit Signed-off-by: Perry Naseck <[email protected]>
fde4bf0
to
1a788e5
Compare
Signed-off-by: Perry Naseck <[email protected]>
…d-socket-activation Signed-off-by: Perry Naseck <[email protected]>
Requesting Review from @discordianfish, @roidelapluie, or @SuperQ |
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.
Minor nit on docs, otherwise LGTM.
Signed-off-by: Perry Naseck <[email protected]>
@SuperQ Updated and pushed minor doc change! |
Signed-off-by: Perry Naseck <[email protected]>
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.
Minor nit, but otherwise LGTM.
Signed-off-by: Perry Naseck <[email protected]>
Signed-off-by: Perry Naseck <[email protected]>
ping @roidelapluie @SuperQ are we good to go? |
Going to close and re-open to try and trigger CI. |
Signed-off-by: Perry Naseck <[email protected]>
@SuperQ Now passing tests! 🎉 |
Nice, I think this is ready to go. Thanks for all of the work here, I'm really looking forward to having this done. But I want to give @roidelapluie one more chance to look at it. |
@roidelapluie @SuperQ let me know if any further changes are needed! Thanks! |
Thanks! |
* [CHANGE] Change some structs suffix from `Struct` to `Config` #114 * [FEATURE] Add multiple listeners and systemd socket support #95 * [FEATURE] Allow TLS parameters to be set in code #110 Signed-off-by: SuperQ <[email protected]>
* [CHANGE] Change some structs suffix from `Struct` to `Config` #114 * [FEATURE] Add multiple listeners and systemd socket support #95 * [FEATURE] Allow TLS parameters to be set in code #110 Signed-off-by: SuperQ <[email protected]>
* [CHANGE] Change some structs suffix from `Struct` to `Config` #114 * [FEATURE] Add multiple listeners and systemd socket support #95 * [FEATURE] Allow TLS parameters to be set in code #110 Signed-off-by: SuperQ <[email protected]> Signed-off-by: SuperQ <[email protected]>
I called the function
UseActivatedSocketAndServe
. Let me know if I should change that. Uses the latest version of the systemd module (v22
).Discussion at node_exporter: prometheus/node_exporter#2393
Per CONTRIBUTING.MD, @SuperQ @roidelapluie
Signed-off-by: Perry Naseck [email protected]