Skip to main content

serve_admin_from_env_with

Function serve_admin_from_env_with 

Source
pub async fn serve_admin_from_env_with(
    default_addr: &str,
    extra: Router,
) -> Result<()>
Expand description

Like serve_admin_from_env, but it also merges extra with the pprof routes.

extra is, for example, a GET /metrics route. Services that expose Prometheus metrics call this function with their /metrics router, and the exporter thus shares the admin port.

§Errors

Returns an error if the listener cannot bind or the HTTP server fails.

§Panics

Panics if KRABKA_ADMIN_LISTEN_ADDR, or default_addr when it is absent, is not a socket address. Router merging also panics if extra conflicts with an existing profiling route.