Skip to content
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 port public getter in HTTPServer #414

Merged
merged 1 commit into from
Aug 22, 2018

Conversation

kovalevm
Copy link
Contributor

If I don't want to configurate port for metrics I can pass '0' and it means use random avalible port, it's very useful but how I can know which port was used?

Signed-off-by: Mikhail Kovalev <mikhail.kovalev@orbitsoft.com>
@brian-brazil
Copy link
Contributor

Can you explain your setup where this comes up? How is Prometheus discovering this port?

@kovalevm
Copy link
Contributor Author

@brian-brazil I use it like this:
HTTPServer server = new HTTPServer(0);

After that line my app create web server on localhost:%random avalible port%. It's simple.
But after that I want to register this server in a service discovery (Consul in my case), after successful registration prometheus sees new service and automatically extracts metrics.
But It doesn't work if I don't know the port.

@brian-brazil brian-brazil merged commit 1062bad into prometheus:master Aug 22, 2018
@brian-brazil
Copy link
Contributor

That makes sense. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants