package scala
Type Members
-
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 } }
-
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.
ExampleActorbelow) + .receiveCounterUse 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
-
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.
ExampleActorbelow) +.receiveExceptionMeterUse 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
-
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.
ExampleActorbelow) +.receiveTimerUse 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