Skip to content

Instantly share code, notes, and snippets.

@gseitz
Created October 3, 2011 05:38
Show Gist options
  • Save gseitz/1258500 to your computer and use it in GitHub Desktop.
Save gseitz/1258500 to your computer and use it in GitHub Desktop.
Trait for exposing metrics for akka-actors.
import akka.actor.Actor
import com.yammer.metrics.Instrumented
// Useful for monitoring the mailbox size of actors.
// Just fire up your favorite JMX client and watch the pretty graph (which hopefully is a flatline at 0).
trait ActorMetrics extends Instrumented { actor: Actor =>
metrics.gauge("mailbox size", self.id){actor.self.dispatcher.mailboxSize(actor.self)}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment