Lagom Projections configuration

Metrics about the projection of events are enabled when Cinnamon’s Lagom Projection dependency is on the classpath.

libraryDependencies ++= Cinnamon.library.cinnamonLagomProjection

Metrics of the projection actors

Each Lagom projection uses a group of sharded actors across the cluster. Each Projection over a persistent entity has as many workers as that entity sharded tags. These actors don’t receive any message and, instead, run an Akka stream internally. For that reason, the only meaningful metric is Running Actors. The formula to know if you have the correct number of actors running is:

  • for each persistent entity { number of shard for the entity eventType * number of projections for that eventType }

That is, you must have as many instances of com.lightbend.lagom.internal.broker.kafka.TopicProducerActor as number of shards in an event stream times number of topics consuming that event stream. Similarly with com.lightbend.lagom.internal.{javadsl,scaladsl}.persistence.ReadSideActor instance for ReadSideProcessor instances.

When you stop/resume a projection using the Projections API the number of running actors will reflect the new state.

cinnamon.akka.actors {

  # To enable metrics for the read side processor actors using Lagom's javadsl use:
  "com.lightbend.lagom.internal.javadsl.persistence.ReadSideActor" {
    report-by = group
  }

  # To enable metrics for the read side processor actors using Lagom's scaladsl use:
  "com.lightbend.lagom.internal.scaladsl.persistence.ReadSideActor" {
    report-by = group
  }

  # To enable metrics for the topic producer actors (either javadsl or scaladsl) use:
  "com.lightbend.lagom.internal.broker.kafka.TopicProducerActor" {
    report-by = group
  }

}