Build Status Maven Central codecov.io

prometheus-akka

This project is a fork of Kamon-Akka. The Kamon team have done a great job and if you are just experimenting with metrics collection, then their tools and documentation are a great starting point. Our internal monitoring tools work better with Prometheus Java Client based metrics than with Kamon based metrics. The use of the Monsanto Kamon-Prometheus bridge was not as smooth as we had hoped.

Other Differences from Kamon-Akka:

  • we do not support Kamon TraceContexts, as we currently have no use case for them
  • we only support Scala 2.11 and Scala 2.12
  • we only build with Akka 2.4 but we test the build with Akka 2.5 too
  • we have added Actor Group support (similar support was recently added to kamon-akka) - see description in Metrics section
  • records time in seconds as opposed to nanoseconds (the data is still a double) - since 0.8.0
"com.workday" %% "prometheus-akka" % "0.8.5"

There is a sample project at https://github.com/pjfanning/prometheus-akka-sample

Release Notes

Usage

To enable monitoring, include the appropriate jar as a dependency and include the following Java runtime flag in your Java startup command (aspectjweaver is a transitive dependency of prometheus-akka):

-javaagent:/path/to/aspectjweaver-1.8.13.jar

If you don't have a Prometheus Metrics endpoint already, you can use the Prometheus MetricsServlet. If you don't want to use a servlet, you can work directly with the Prometheus TextFormat class.

Configuration

The metrics are configured using application.conf files. There is a default reference.conf that enables only some metrics.

Metrics

Dispatcher

  • differs a little between ForkJoin dispatchers and ThreadPool dispatchers
  • ForkJoin: parallelism, activeThreadCount, runningThreadCount, queuedSubmissionCount, queuedTaskCountGauge stealCount
  • ThreadPool: activeThreadCount, corePoolSize, currentPoolSize, largestPoolSize, maxPoolSize, completedTaskCount, totalTaskCount

Actor System

  • Only added in v0.8.2
  • Actor Count
  • Unhandled Message Count
  • Dead Letter Count

Actor

  • One metric per actor instance
  • mailboxSize (current size), processingTime, timeInMailbox, message count, error count

Actor Router

  • One metric per router instance, summed across all routee actors
  • routingTime, timeInMailbox, message count, error count

Actor Group

  • Each actor group has its own include/exclude rules and you can define many groups with individual actors being allowed to be included in many groups - the metrics are summed across all actors in the group
  • actorCount (current active actors), mailboxSize (current size), processingTime, timeInMailbox, message count, error count