counter

fun counter(name: String, block: CounterBuilder.() -> Unit): Counter

DSL-style function to build and register a Counter using a CounterBuilder.

Example:

val requests = counter("http_requests_total") {
help("Total HTTP requests")
labelNames("method", "status")
}

Return

A configured Counter instance.

Parameters

name

The base name of the counter metric.

block

Configuration block for the CounterBuilder.