All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.kontainers.micrometer.akka.GaugeWrapper.scala Maven / Gradle / Ivy

There is a newer version: 0.12.3
Show newest version
package io.kontainers.micrometer.akka

import java.util.concurrent.atomic.DoubleAdder

import scala.collection.JavaConverters._

import io.kontainers.micrometer.akka.impl.DoubleFunction
import io.micrometer.core.instrument.{MeterRegistry, Tag}

case class GaugeWrapper(registry: MeterRegistry, name: String, tags: Iterable[Tag]) {
  private val adder = new DoubleAdder
  private val fn = new DoubleFunction[DoubleAdder](_.doubleValue)
  registry.gauge(name, tags.asJava, adder, fn)
  def decrement(): Unit = increment(-1.0)
  def increment(): Unit = increment(1.0)
  def increment(d: Double): Unit = adder.add(d)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy