nl.grons.metrics.scala

CheckedBuilder

trait CheckedBuilder extends AnyRef

The mixin trait for creating a class which creates health checks.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. CheckedBuilder
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Abstract Value Members

  1. val registry : HealthCheckRegistry

    The com.codahale.metrics.health.HealthCheckRegistry where created metrics are registered.

    The com.codahale.metrics.health.HealthCheckRegistry where created metrics are registered.

    Attributes
    abstract

Concrete Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  7. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  8. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  9. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  11. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  12. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  13. def healthCheck (name: String, unhealthyMessage: String = "Health check failed")(checker: HealthCheckMagnet): HealthCheck

    Converts a code block to a com.codahale.metrics.health.HealthCheck and registers it.

    Converts a code block to a com.codahale.metrics.health.HealthCheck and registers it.

    Use it as follows:

    object Application {
      // The application wide health check registry.
      val healthCheckRegistry = new com.codahale.metrics.health.HealthCheckRegistry()
    }
    trait Checked extends CheckedBuilder {
      val healthCheckRegistry = Application.healthCheckRegistry
    }
    
    class Example(db: Database) extends Checked {
      private[this] val databaseCheck = healthCheck("database") { db.isConnected }
    }
    

    The code block must have a result of type Boolean, Either, or com.codahale.metrics.health.HealthCheck.Result.

    • A check result of true indicates healthy, false indicates unhealthy.
    • A check result of type Right[AnyVal] indicates healthy, Left[AnyVal] or Left[Throwable] indicates unhealthy. The embedded value (after applying .toString) or throwable is used as (un)healthy message.
    • If the check result is of type Result, the result is passed unchanged.
    • In case the code block throws an exception, the result is considered 'unhealthy'.
    name

    the name of the health check

    unhealthyMessage

    the unhealthy message for checkers that return false, defaults to "Health check failed"

    checker

    the code block that does the health check

  14. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  15. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  16. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  17. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  18. val owner : Class[_]

    The owner of the health check.

  19. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  20. def toString (): String

    Definition Classes
    AnyRef → Any
  21. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  22. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  23. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any