Skip to content

metrics-exporter-prometheus: Add API to initialize HTTP listener from existing TcpListener #590

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

michelhe
Copy link
Contributor

@michelhe michelhe commented Jul 3, 2025

This commit adds a new API to the PrometheusBuilder that allows users to provide their own configured TCP listener. The use case is to enable users to configure the TCP listener before passing it to the exporter - for example, to set socket options or bind to port 0 and retrieve the port number assigned by the OS.

My own use case for this is to use port=0 and then grab the port, log it and then give it to PrometheusBuilder

@tobz
Copy link
Member

tobz commented Jul 7, 2025

I do intend to look at this soon, but changes to PrometheusBuilder that add additional variants are usually low down on my list: it already contains a large number of methods, which makes trying to thinking through if we really should add something take a little more time.

@tobz tobz added C-exporter Component: exporters such as Prometheus, TCP, etc. E-simple Effort: simple. T-enhancement Type: enhancement. T-ergonomics Type: ergonomics. labels Jul 7, 2025
@michelhe michelhe force-pushed the bring-your-own-socket branch from 5e9f6d4 to 0b0b132 Compare July 8, 2025 13:57
… TCP listener

This commit adds a new API to the `PrometheusBuilder` that allows users to provide their own configured TCP listener.
The use case is to enable users to configure the TCP listener before passing it to the exporter - for example, to set socket options or
bind to port 0 and retrieve the port number assigned by the OS.

Signed-off-by: Michel Heily <michel.heily@wiz.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-exporter Component: exporters such as Prometheus, TCP, etc. E-simple Effort: simple. T-enhancement Type: enhancement. T-ergonomics Type: ergonomics.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants