nl.grons.metrics

scala

package scala

Visibility
  1. Public
  2. All

Type Members

  1. trait BaseBuilder extends AnyRef

  2. final class ByName[+T] extends () ⇒ T

    Provides a wrapper for by-name expressions with the intent that they can become eligible for implicit conversions and implicit resolution.

    Provides a wrapper for by-name expressions with the intent that they can become eligible for implicit conversions and implicit resolution.

    T

    Result type of the evaluated expression

  3. trait CheckedBuilder extends BaseBuilder

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

  4. class Counter extends AnyRef

    A Scala facade class for DropwizardCounter.

  5. trait FutureMetrics extends AnyRef

    Provides timing of future executions.

  6. class Gauge[T] extends AnyRef

    A Scala facade class for DropwizardGauge.

  7. class HdrMetricBuilder extends MetricBuilder

    An alternative metric builder that creates Histograms and Timers with Reservoirs from the HdrHistogram library.

    An alternative metric builder that creates Histograms and Timers with Reservoirs from the HdrHistogram library.

    See the the manual for more instructions on using hdrhistogram.

  8. sealed trait HealthCheckMagnet extends AnyRef

    Magnet for the checker.

  9. class Histogram extends AnyRef

    A Scala facade class for DropwizardHistogram.

  10. trait InstrumentedBuilder extends BaseBuilder

    The mixin trait for creating a class which is instrumented with metrics.

    The mixin trait for creating a class which is instrumented with metrics.

    Use it as follows:

    object Application {
      // The application wide metrics registry.
      val metricRegistry = new com.codahale.metrics.MetricRegistry()
    }
    trait Instrumented extends InstrumentedBuilder {
      val metricRegistry = Application.metricRegistry
    }
    
    class Example(db: Database) extends Instrumented {
      private[this] val loading = metrics.timer("loading")
    
      def loadStuff(): Seq[Row] = loading.time {
        db.fetchRows()
      }
    }

    It is also possible to override the metric base name. For example:

    class Example(db: Database) extends Instrumented {
      override lazy val metricBaseName = MetricName("Overridden.Base.Name")
      private[this] val loading = metrics.timer("loading")
    
      def loadStuff(): Seq[Row] = loading.time {
        db.fetchRows()
      }
    }

    If you want to use hdrhistograms, you can override the metric builder as follows:

    trait Instrumented extends InstrumentedBuilder {
      override lazy protected val metricBuilder = new HdrMetricBuilder(metricBaseName, metricRegistry, false)
      val metricRegistry = Application.metricRegistry
    }

    See the the manual for more instructions on using hdrhistogram.

  11. class Meter extends AnyRef

    A Scala facade class for DropwizardMeter.

    A Scala facade class for DropwizardMeter.

    Example usage:

    class Example(val db: Db) extends Instrumented {
      private[this] val rowsLoadedMeter = metrics.meter("rowsLoaded")
    
      def load(id: Long): Seq[Row] = {
        val rows = db.load(id)
        rowsLoaded.mark(rows.size)
        rows
      }
    }
  12. class MetricBuilder extends AnyRef

    Builds and registering metrics.

  13. class MetricName extends AnyRef

    The (base)name of a metric.

    The (base)name of a metric.

    Constructed via the companion object, e.g. MetricName(getClass, "requests").

  14. trait ReceiveCounterActor extends Actor

    Stackable actor trait which counts received messages.

    Stackable actor trait which counts received messages.

    Metric name defaults to the class of the actor (e.g. ExampleActor below) + .receiveCounter

    Use it as follows:

    object Application {
      // The application wide metrics registry.
      val metricRegistry = new com.codahale.metrics.MetricRegistry()
    }
    trait Instrumented extends InstrumentedBuilder {
      val metricRegistry = Application.metricRegistry
    }
    
    class ExampleActor extends Actor {
    
      def receive = {
        case _ => doWork()
      }
    }
    
    class InstrumentedExampleActor extends ExampleActor with ReceiveCounterActor with Instrumented
  15. trait ReceiveExceptionMeterActor extends Actor

    Stackable actor trait which meters thrown exceptions.

    Stackable actor trait which meters thrown exceptions.

    Metric name defaults to the class of the actor (e.g. ExampleActor below) + .receiveExceptionMeter

    Use it as follows:

    object Application {
      // The application wide metrics registry.
      val metricRegistry = new com.codahale.metrics.MetricRegistry()
    }
    trait Instrumented extends InstrumentedBuilder {
      val metricRegistry = Application.metricRegistry
    }
    
    class ExampleActor extends Actor {
    
      def receive = {
        case _ => doWork()
      }
    }
    
    class InstrumentedExampleActor extends ExampleActor with ReceiveCounterActor with Instrumented
  16. trait ReceiveTimerActor extends Actor

    Stackable actor trait which times the message receipt.

    Stackable actor trait which times the message receipt.

    Metric name defaults to the class of the actor (e.g. ExampleActor below) + .receiveTimer

    Use it as follows:

    object Application {
      // The application wide metrics registry.
      val metricRegistry = new com.codahale.metrics.MetricRegistry()
    }
    trait Instrumented extends InstrumentedBuilder {
      val metricRegistry = Application.metricRegistry
    }
    
    class ExampleActor extends Actor {
    
      def receive = {
        case _ => doWork()
      }
    }
    
    class InstrumentedExampleActor extends ExampleActor with ReceiveCounterActor with Instrumented
  17. class Timer extends AnyRef

    A Scala facade class for DropwizardTimer.

    A Scala facade class for DropwizardTimer.

    Example usage:

    class Example(val db: Db) extends Instrumented {
      private[this] val loadTimer = metrics.timer("load")
    
      def load(id: Long) = loadTimer.time {
        db.load(id)
      }
    }

Value Members

  1. object ByName

  2. object Gauge

  3. object HealthCheckMagnet

  4. object MetricName

Ungrouped