Gradle

Lightbend Telemetry uses a Java Agent to add specially crafted instrumentation to the Lightbend Platform for efficient telemetry.

You will need to add the agent to your Gradle build and deployment to enable the telemetry.

Bintray credentials

To gain access to Lightbend Telemetry you must have a Lightbend subscription and Lightbend account.

Once you have logged in, the Lightbend platform credentials guide contains instructions for configuring your sbt, maven or gradle project to access Lightbend’s commercial dependencies, including Telemetry. If you have previously used a username and password to configure your Bintray credentials, the guide will instruct you how to update to using the new scheme.

Note: The URLs generated as part of your Lightbend platform credentials should not be committed to public source control repositories.

If you do not have a Lightbend subscription, please contact us to request an evaluation.

Getting the Agent

To automatically pull down the agent as part of your build, you can add the following.

// Add the agent to a separate configuration so it doesn't add to the normal class path
configurations {
  agent
}

dependencies {
  agent group: 'com.lightbend.cinnamon', name: 'cinnamon-agent', version: '2.14.2'
}

Adding the Agent

Next, the agent needs to be added as a java command line option. Here is a sample of how to add the agent to the run and test configurations.

run.doFirst {
  jvmArgs "-javaagent:${configurations.agent.singleFile}"
}

test.doFirst {
  jvmArgs "-javaagent:${configurations.agent.singleFile}"
}

Complete Sample

Here is a complete sample of a Gradle build file configured to use the Cinnamon Agent, the Coda Hale Metrics plugin, Akka Instrumentation, and Akka HTTP Instrumentation.

apply plugin: 'java'

// Generate your Lightbend commercial repositories config for gradle at:
//   https://www.lightbend.com/account/lightbend-platform/credentials

// Add the agent to a separate configuration so it doesn't add to the normal class path
configurations {
  agent
}

dependencies {
  agent group: 'com.lightbend.cinnamon', name: 'cinnamon-agent', version: '2.14.2'
}

// Use Coda Hale Metrics
dependencies {
  compile group: 'com.lightbend.cinnamon', name: 'cinnamon-chmetrics', version: '2.14.2'
}
// Use Akka instrumentation
dependencies {
  compile group: 'com.lightbend.cinnamon', name: 'cinnamon-akka_2.12', version: '2.14.2'
}
dependencies {
  compile group: 'com.lightbend.cinnamon', name: 'cinnamon-akka-typed_2.12', version: '2.14.2'
}
dependencies {
  compile group: 'com.lightbend.cinnamon', name: 'cinnamon-akka-persistence_2.12', version: '2.14.2'
}

dependencies {
  compile group: 'com.lightbend.cinnamon', name: 'cinnamon-akka-stream_2.12', version: '2.14.2'
}

// Use Akka HTTP instrumentation
dependencies {
  compile group: 'com.lightbend.cinnamon', name: 'cinnamon-akka-http_2.12', version: '2.14.2'
}

dependencies {
  compile group: 'com.typesafe.akka', name: 'akka-actor_2.12', version: '2.5.31'
}

run.doFirst {
  jvmArgs "-javaagent:${configurations.agent.singleFile}"
}

test.doFirst {
  jvmArgs "-javaagent:${configurations.agent.singleFile}"
}