nl.grons.metrics4.scala

Members list

Type members

Classlikes

trait ActorInstrumentedLifeCycle extends Actor

Stackable Actor trait which links Gauge life cycles with the actor life cycle.

Stackable Actor trait which links Gauge life cycles with the actor life cycle.

When an actor is restarted, gauges can not be created again under the same name in the same metric registry. By mixing in this trait, all gauges created in this actor will be automatically unregistered before this actor restarts.

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 with Instrumented with ActorInstrumentedLifecycle {

 var counter = 0

 // The following gauge will automatically unregister before a restart of this actor.
 metrics.gauge("sample-gauge"){
   counter
 }

 override def receive = {
   case 'increment =>
     counter += 1
     doWork()
 }

 def doWork(): Unit = {
   // etc etc etc
 }
}

Attributes

Supertypes
trait Actor
class Object
trait Matchable
class Any
Self type
InstrumentedBuilder
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

Attributes

Supertypes
trait Actor
class Object
trait Matchable
class Any
Self type
InstrumentedBuilder
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

Attributes

Supertypes
trait Actor
class Object
trait Matchable
class Any
Self type
InstrumentedBuilder
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

Attributes

Supertypes
trait Actor
class Object
trait Matchable
class Any
Self type
InstrumentedBuilder