You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I often wrap APIs with a small layer of Python to turn metrics into something that Prometheus can ingest. Rather than adding while True: sleep(1) or similar at the end of my scripts I would like to do this:
I think I would be ok with this but will give a bit of time for others to chime in as well. My only initial concern would be that it would make it a bit harder to change an internal implementation, but that is fairly minor.
Correct, start_http_server is designed to be as simple as possible for use cases such as a lightweight exporter. If additional functionality is required it is encouraged to use a different server.
I am in favor of a way to control with the thing created. Having a start_http_server not returning a handle is like a copy command that copies files but doesn't tell you where it put the file copy and now it's a game of hide and seek. ;-)
#999 will implement this. It returns the server as well as the thread to allow shutdowns, happy to hear any comments about that and will otherwise merge it soon.
Activity
[-]Return thread from start_http_server[/-][+]Please return thread from start_http_server[/+]csmarchbanks commentedon Jan 23, 2023
I think I would be ok with this but will give a bit of time for others to chime in as well. My only initial concern would be that it would make it a bit harder to change an internal implementation, but that is fairly minor.
hholst80 commentedon Jan 29, 2023
I was thinking about this. How do I shut down the serving component? I guess I don't and just shutdown the application.
csmarchbanks commentedon Feb 7, 2023
Correct,
start_http_serveris designed to be as simple as possible for use cases such as a lightweight exporter. If additional functionality is required it is encouraged to use a different server.hholst80 commentedon Feb 8, 2023
I am in favor of a way to control with the thing created. Having a start_http_server not returning a handle is like a copy command that copies files but doesn't tell you where it put the file copy and now it's a game of hide and seek. ;-)
andy-maier commentedon Nov 28, 2023
We would also like to have that, see issue #983.
csmarchbanks commentedon Jan 25, 2024
#999 will implement this. It returns the server as well as the thread to allow shutdowns, happy to hear any comments about that and will otherwise merge it soon.