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

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

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

import java.io.Closeable
import java.util.concurrent.TimeUnit

import io.micrometer.core.instrument.Timer

case class TimerWrapper(timer: Timer) {

  class TimeObservation(timer: Timer, startTime: Long) extends Closeable {
    def close(): Unit = timer.record(System.nanoTime() - startTime, TimeUnit.NANOSECONDS)
  }

  def startTimer(): TimeObservation = new TimeObservation(timer, System.nanoTime())
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy