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

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

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.5.0'
}

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'

repositories {
    maven {
        credentials {
            username 'your username'
            password 'your password'
        }
        mavenCentral()
        url = 'https://repo.lightbend.com/commercial-releases'
    }
}

// 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.5.0'
}

// Use Coda Hale Metrics
dependencies {
  compile group: 'com.lightbend.cinnamon', name: 'cinnamon-chmetrics_2.11', version: '2.5.0'
}
// Use Akka instrumentation
dependencies {
  compile group: 'com.lightbend.cinnamon', name: 'cinnamon-akka_2.11', version: '2.5.0'
}

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

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

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

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