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

com.github.pjfanning.micrometer.pekko.TimerWrapper.scala Maven / Gradle / Ivy

The newest version!
package com.github.pjfanning.micrometer.pekko

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 - 2025 Weber Informatics LLC | Privacy Policy