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

org.scalatra.metrics.HealthChecksSupport.scala Maven / Gradle / Ivy

The newest version!
package org.scalatra.metrics

import nl.grons.metrics4.scala._

trait HealthChecksSupport extends CheckedBuilder with MetricsBootstrap {
  val registry = healthCheckRegistry

  private type ToMagnet[T] = ByName[T] => HealthCheckMagnet

  def healthCheckName(name: String) = MetricName(name)

  def checkHealth[T](name: String)(checker: => T)(implicit toMagnet: ToMagnet[T]) =
    healthCheck(name) { checker }
  def checkHealth[T](name: String, unhealthyMessage: String)(checker: => T)(implicit toMagnet: ToMagnet[T]) =
    healthCheck(name, unhealthyMessage) { checker }

  def runHealthCheck(name: String) = healthCheckRegistry.runHealthCheck(name)
  def runHealthChecks() = healthCheckRegistry.runHealthChecks()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy