Skip to content

Add the Datadog Java APM agent to your sbt project

Notifications You must be signed in to change notification settings

ghostbuster91/sbt-datadog

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sbt-datadog

Disclaimer

This is a fork of the original (that I also wrote a long time ago), now unmaintained, Colisweb/sbt-datadog

Documentation

This project is highly inspired by the fantastic sbt-newrelic project.

We want to thanks Gilt for their work on sbt-newrelic that allowed us to create this project really quickly.

Prerequisites

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.6.x).

Installation

Add the following to your project/plugins.sbt file:

addSbtPlugin("com.guizmaii" % "sbt-datadog" % "4.9.4")

To enable the Datadog APM for your project, add the DatadogAPM auto-plugin to your project.

enablePlugins(DatadogAPM)

Configuration

datadogApmVersion

To use a specific Datadog Java APM Agent version, add the following to your build.sbt file:

datadogApmVersion := "0.108.1"

datadogApmEnabled

You can easily disable the Datadog APM by settings this setting to false.
Note that if you have the DD_TRACE_ENABLED environment variable set, it'll take precedence over this setting.
See https://docs.datadoghq.com/tracing/trace_collection/library_config/java/

Default value: true

datadogApmEnabled := true

datadogProfilingEnabled

Datadog Profiling. See https://docs.datadoghq.com/profiler/enabling/java/?tab=commandarguments

Default value: true Will be deactivated if datadogApmEnabled is false

datadogProfilingEnabled := true

datadogAllocationProfilingEnabled

Datadog Allocations Profiling. See https://docs.datadoghq.com/profiler/enabling/java/?tab=commandarguments

Default value: true Will be deactivated if datadogApmEnabled is false

datadogAllocationProfilingEnabled := true

datadogServiceName

By default, the agent will use the sbt project name value as service.name.

To use another value, add the following to your build.sbt file:

datadogServiceName := "another name"

You can use your host (where you code run) environment variables in the value:

datadogServiceName := "another name ${MY_HOST_ENV_VAR}"

datadogAgentTraceUrl

Defines how the APM will communicate with the Datadog Agent.

Two ways are available:

  • via Unix Socket (default)
  • via HTTP

By default, the agent trace.agent.url value is /var/run/datadog/apm.socket.

To use a different Unix Socket, add the following to your build.sbt file:

datadogAgentTraceUrl := TraceAgentUnixSocketUrl(socket = "/my/directory/my.socket")

To use the default HTTP URL (locahost:8126), add the following to your build.sbt file:

datadogAgentTraceUrl := TraceAgentUrl.defaultHttpUrl

To use a custom HTTP URL, add the following to your build.sbt file:

datadogAgentTraceUrl := TraceAgentHttpUrl(host = "my.host.address.com", port = "8888")

You can use your host (where you code run) environment variables in the values:

datadogAgentTraceUrl := TraceAgentHttpUrl(host = "${MY_DD_HOST_IP}", port = "8888")
// Or
datadogAgentTraceUrl := TraceAgentUnixSocketUrl(socket = "${MY_DD_UNIX_SOCKET}")

datadogEnableDebug

To return debug level application logs, enable debug mode with this flag. Default value is false.

To use another value, add the following to your build.sbt file:

datadogEnableDebug := true

datadogGlobalTags

A list of default tags to be added to every span and every JMX metric. Default value is an empty list.

To add global tags:

datadogGlobalTags := Map("env" -> "testing", "version" -> "testing-4c84587e")

Other possible settings

For more configuration option, look at the Datadog Java APM agent documentation: https://docs.datadoghq.com/tracing/setup/java/

About

Add the Datadog Java APM agent to your sbt project

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 100.0%