Child

inner class Child

Represents a labeled child of the counter metric.

Use this to operate on a specific label set:

counter.labels("GET").inc()

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
suspend fun <T> Counter.Child.countExceptions(vararg exceptionTypes: KClass<out Throwable>, block: () -> T): T?

Executes the given block and increments the counter if an exception of the specified types is thrown.

Link copied to clipboard
fun get(): Double

Retrieves the current value of the counter.

Link copied to clipboard
suspend fun inc()

Increments the counter by 1.

suspend fun inc(amount: Double)

Increments the counter by the specified amount. To update the value we must first tranform from raw bits to Double, then add the amount, and finally convert back to raw bits for atomic storage.