sbt

Lightbend Monitoring uses a Java Agent to add specially crafted instrumentation to the Lightbend Platform for efficient monitoring.

You will need to add this agent to your sbt build and deployment to enable the monitoring.

Required sbt version

Make sure that your project is using an sbt version of 0.13.7 or higher. Set the sbt version in project/build.properties:

sbt.version=0.13.11

Bintray credentials

Follow these instructions to set up your Bintray credentials for sbt.

Lightbend Monitoring sbt Plugin

We provide a convenient sbt plugin, called sbt-cinnamon, that makes it easy to add the Cinnamon Java Agent and other monitoring dependencies to your build. To use this plugin, add the following plugin and repository to your project/plugins.sbt file:

addSbtPlugin("com.lightbend.cinnamon" % "sbt-cinnamon" % "2.0.0")

credentials += Credentials(Path.userHome / ".lightbend" / "commercial.credentials")

resolvers += Resolver.url("lightbend-commercial", url("https://repo.lightbend.com/commercial-releases"))(Resolver.ivyStylePatterns)

Next, you need to add the sbt-cinnamon plugin to your project by enabling it in your build.sbt:

// Enable the Cinnamon Lightbend Monitoring sbt plugin
lazy val app = project in file(".") enablePlugins (Cinnamon)

Enabling the plugin automatically adds the Cinnamon Agent to your dist scope, which in turn attaches the Agent to your distribution when using sbt-native-packager. If you want to utilize the agent while running or testing, then you will need to add the following to your build.sbt as well:

// Add the Monitoring Agent for run and test
cinnamon in run := true
cinnamon in test := true

There is also a convenient way to set the log level of the Cinnamon Agent in your build.sbt file:

// Set the Monitoring Agent log level
cinnamonLogLevel := "INFO"

Complete Sample

Here is a complete sample of sbt plugins and build files configured to use the Cinnamon Agent and the Coda Hale Metrics integration together with Akka.

project/plugins.sbt

addSbtPlugin("com.lightbend.cinnamon" % "sbt-cinnamon" % "2.0.0")

credentials += Credentials(Path.userHome / ".lightbend" / "commercial.credentials")

resolvers += Resolver.url("lightbend-commercial", url("https://repo.lightbend.com/commercial-releases"))(Resolver.ivyStylePatterns)

build.sbt

// Enable the Cinnamon Lightbend Monitoring sbt plugin
lazy val app = project in file(".") enablePlugins (Cinnamon)

// Add the Monitoring Agent for run and test
cinnamon in run := true
cinnamon in test := true

// Set the Monitoring Agent log level
cinnamonLogLevel := "INFO"

version := "0.0.1-SNAPSHOT"

scalaVersion := "2.11.8"

// Use Coda Hale Metrics
libraryDependencies += Cinnamon.library.cinnamonCHMetrics
// Use Akka instrumentation
libraryDependencies += Cinnamon.library.cinnamonAkka

libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.4.6"

As you can see, the sbt-cinnamon plugin also has helpers for adding Cinnamon dependencies to your build. For example, different backend plugins such as cinnamonCHMetrics or specific instrumentations like cinnamonAkka.

Backend dependencies cinnamonCHMetrics or cinnamonTakipi, and the instrumentation cinnamonAkka are required when monitoring Akka.