Meter

nl.grons.metrics4.scala.Meter
class Meter(metric: Meter)

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
   }
 }

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Classlikes

Gives a marker that runs f, marks the meter on an exception, and returns result of f.

Gives a marker that runs f, marks the meter on an exception, and returns result of f.

Example usage:

 class Example(val db: Db) extends Instrumented {
   private[this] val loadExceptionMeter = metrics.meter("load").exceptionMarker

   def load(id: Long) = loadExceptionMeter {
     db.load(id)
   }
 }

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Converts partial function pf into a side-effecting partial function that meters thrown exceptions for every invocation of pf (for the cases it is defined). The result is passed unchanged.

Converts partial function pf into a side-effecting partial function that meters thrown exceptions for every invocation of pf (for the cases it is defined). The result is passed unchanged.

Example usage:

class Example extends Instrumented {
  val isEven: PartialFunction[Int, String] = {
    case x if x % 2 == 0 => x+" is even"
    case 5 => throw new IllegalArgumentException("5 is unlucky")
  }

  val isEvenExceptionMeter = metrics.meter("isEvenExceptions")
  val meteredIsEven: PartialFunction[Int, String] = isEvenExceptionMeter.exceptionMarkerPF(isEven)

  val sample = 1 to 10
  sample collect meteredIsEven   // the meter counts 1 exception
}

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Value members

Concrete methods

def count: Long

The number of events which have been marked.

The number of events which have been marked.

Attributes

def fifteenMinuteRate: Double

The fifteen-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.

The fifteen-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.

This rate has the same exponential decay factor as the fifteen-minute load average in the top Unix command.

Attributes

def fiveMinuteRate: Double

The five-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.

The five-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.

This rate has the same exponential decay factor as the five-minute load average in the top Unix command.

Attributes

def mark(): Unit

Marks the occurrence of an event.

Marks the occurrence of an event.

Attributes

def mark(count: Long): Unit

Marks the occurrence of a given number of events.

Marks the occurrence of a given number of events.

Attributes

def meanRate: Double

The mean rate at which events have occurred since the meter was created.

The mean rate at which events have occurred since the meter was created.

Attributes

def oneMinuteRate: Double

The one-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.

The one-minute exponentially-weighted moving average rate at which events have occurred since the meter was created.

This rate has the same exponential decay factor as the one-minute load average in the top Unix command.

Attributes