Add --metrics-address to specify a listening address specifically for the metrics server #4747
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently both the HTTP API and Prometheus metrics server listen on the same address specified using
--http-address
, but there are scenarios where you may want to expose the HTTP API only on localhost, and make the metrics more publicly accessible for Prometheus to scrape.The existing implementation also prevents you from changing the address of the metrics server if the HTTP API is disabled (
TRITON_ENABLE_HTTP
unset), since the--http-address
flag is not available in that case.This PR introduces a new command line parameter
--metrics-address
that allows you to specify an address specifically for the Prometheus metrics server, which may be different from the--http-address
.I've implemented it to not be a breaking change; if you only specify
--http-address
without--metrics-address
then the metrics server will listen on the same address as the HTTP server, just like the existing behavior.