MetricsService

constructor(port: Int, path: String, host: String? = null, registry: PrometheusRegistry = PrometheusRegistry.defaultRegistry, filters: List<Filter> = [], initBlock: MetricsService.() -> Unit = {})

Parameters

port

The HTTP port for the metrics endpoint.

path

The URL path for the Prometheus metrics servlet, with or without a leading slash.

host

The interface to bind to. The default, null, binds 127.0.0.1, so only local clients can connect; use "0.0.0.0" to accept connections on every interface, such as scrapes from another host or container.

registry

The PrometheusRegistry to serve. Defaults to PrometheusRegistry.defaultRegistry.

filters

The servlet filters every request passes through, in order, before it reaches the metrics servlet.

initBlock

An optional initialization block invoked after the service listener is registered.