pub fn bind(addr: SocketAddr) -> Result<TcpListener>Expand description
Bind the /metrics HTTP listener synchronously so startup can fail fast
if the port is unavailable. The returned listener is consumed by serve.
Emits a WARN if addr is non-loopback (#579). The OpenMetrics
surface exposes pull-through byte volumes and GC/connection stats —
useful reconnaissance for anyone who can reach it. The default config
binds loopback (appendix-local-admin-http calls metrics
“loopback-only”), but observability.metrics_bind is operator-
settable to 0.0.0.0 for containerised deployments
(crates/common/src/config/types.rs — ObservabilityConfig::metrics_bind).
We warn but do not reject so that documented container workflows
keep working.
§Errors
Returns an error if the underlying crate::net::bind_reuseaddr fails —
socket creation, bind (port in use, permissions), or listen.