newrelic support for any artifacts built with sbt-native-packager
The following is a list of useful links related to newrelic:
- New Relic Java Agent
- New Relic Java Release Notes
- New Relic Java Agent Artifacts
- New Relic Java Agent config file template
- New Relic Java Agent Configuration
The plugin assumes that sbt-native-packager has been included in your SBT build configuration. This can be done by adding the plugin following instructions at http://www.scala-sbt.org/sbt-native-packager/ or by adding another plugin that includes and initializes it (e.g. the SBT plugin for Play 2.4.x).
Add the following to your project/plugins.sbt
file:
addSbtPlugin("com.gilt.sbt" % "sbt-newrelic" % "0.0.10")
To use the NewRelic settings in your project, add NewRelic.packagerSettings
to your build. If you are manually adding sbt-native-packager
archetypes, you should add this line after the archetype has set default values for settings.
NewRelic.packagerSettings
Add the following to your project/plugins.sbt
file:
addSbtPlugin("com.gilt.sbt" % "sbt-newrelic" % "0.1.5")
To use the NewRelic settings in your project, add the NewRelic
auto-plugin to your project.
enablePlugins(NewRelic)
To use a specific New Relic Java Agent version, add the following to your build.sbt
file:
newrelicVersion := "3.27.0"
To add a New Relic license key to the generated newrelic.yml
file, add the following to your build.sbt
file:
newrelicLicenseKey := Some("1234567890abcdef")
An alternative approach is to pass the license key to your application via the NEW_RELIC_LICENSE_KEY
environment variable.
To enable custom tracing, add the following to your build.sbt
file:
newrelicCustomTracing := true
To include the New Relic client API in your project's library dependencies, add to your build:
newrelicIncludeApi := true
To provide a static newrelic.yml
file instead of a generated file, place the
file somewhere (e.g. resourceDirectory
, which is conf/
by default for Play
applications, or src/main/resources
for many other builds), and refer to it
from your build like this:
newrelicConfig := (resourceDirectory in Compile).value / "newrelic.yml"
The application name reported to New Relic may be modified by setting newrelicAppName
, the default value is the name of the project.
newrelicAppName := "My Application"