org.scalatra.metrics.HealthChecksSupport.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalatra-metrics-javax_2.12 Show documentation
Show all versions of scalatra-metrics-javax_2.12 Show documentation
Scalatra integration with Metrics
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