Lagom

Lightbend’s Lagom framework for microservices contains built-in circuit breakers that can be instrumented with Lightbend Telemetry.

Cinnamon Lagom module dependency

Add the Cinnamon Lagom dependency to your build file:

sbt
libraryDependencies += Cinnamon.library.cinnamonLagom
Maven
<dependency>
    <groupId>com.lightbend.cinnamon</groupId>
    <artifactId>cinnamon-lagom_2.11</artifactId>
    <version>2.5.0</version>
</dependency>
Gradle
dependencies {
  compile group: 'com.lightbend.cinnamon', name: 'cinnamon-lagom_2.11', version: '2.5.0'
}

Please note that you also need to add a Backend Plugin, e.g. Coda Hale Metrics or OverOps.

Configuration

To wire up Lagom telemetry in your application you must add the following line to the configuration file:

lagom.spi.circuit-breaker-metrics-class = "cinnamon.lagom.CircuitBreakerInstrumentation"

This instructs Lagom to provide data to Lightbend Telemetry rather than the default behavior.

The information gathered include:

  • State of circuit breaker — closed, open, half-open

  • Latency

  • Throughput

  • Success and failure counts

Lagom circuit breakers

It is important to have an understanding of the circuit breakers in Lagom in order to interpret the data that is gathered. In Lagom each client talking to another service uses a circuit breaker. This basically means that the circuit breaker is on the client instead of the server (in a traditional sense). This means that if your code calls a service directly there will not be any information gathered about this call. Currently only service to service calls are instrumented. More information can on service clients and circuit breakers.

The state of a circuit breaker is one of:

State Interpretation Data Representation
open something is wrong 1
half-open things are going from bad to good 2
closed everything is fine 3

The Data Representation in the above table is the number associated with a certain state, i.e. this is what comes out of Lightbend Telemetry to any reporter listening to the data.