Search code examples
scalaakkametrics

Collecting Akka actor system metrics


Scala 2.12 and Akka here, and pretty new to both. I'm trying to collect some metrics about my actor system at runtime. Specifically, I'm interested in:

  • Getting the # of running actors in my actor system
  • For each actor:
    • Getting the number of messages it has received
    • Getting the number of messages it has sent to other actors
    • Determining how long a message has been in the actor's mailbox
    • Determining how long the actor took to actually process the message
    • Getting the current size of the actor's mailbox
  • Determining how many dead letters have been sent across the entire actor system

I'm hoping Akka has some kind of little known "meta API" where I can go to get these kinds of metrics, otherwise I'm probably going to have to wire up my own instrumentation/telemetry and do everything myself, in which case I'm wondering what that approach might look like?

I see Lightbend has an awesome telemetry library but its commercial and I'm cheap :-)


Solution

  • Maybe Kamon will help you. Here is a documentation about metrics collection in Akka.