this project will easily push your metrics to a dogstatsd-agent in a spring-boot environment. For now, this project will only support Spring-Boot 1.5.x, since in 2.0.x, spring will introduce Micrometer as an abstraction for pushing metrics to various vendors.
Add dogstatsd-spring-boot-starter as dependency.
If you use Maven, add the starter to your dependencies:
<dependency>
<groupId>com.github.robertnetz</groupId>
<artifactId>dogstatsd-spring-boot-starter</artifactId>
<version>1.2</version>
</dependency>If you use Gradle, add your dependency as follows:
repositories {
mavenCentral()
}
dependencies {
compile 'com.github.robertnetz:dogstatsd-spring-boot-starter:1.2'
}As soon as the starter was added to your project, it will send your actuator metrics
to your dogstatsd-agent. by default it will send to localhost:8125.
you can update the configuration by adding new keys to your application.yml as follows.
datadog:
host: otherhost.example.com
port: 12345a feature of the dogstatsd is the tagging-support. to tag all your metrics statically with a provided set of tags, you have to specify them like this:
datadog:
tags:
- foo
- bar
- bam
- bazif you like to have a static prefix to all your metrics, you can do it like that:
datadog:
prefix: superappyou also can disable the metrics export by configuration:
datadog:
enabled: falseYou might not want to export spring actuators' SystemPublicMetrics, then you'll have to disable them explicitly by:
datadog:
includeActuatorMetrics: falseSome libraries you use might be recording metrics with : in their names.
These are currently not supported by the java-dogstatsd-client and cause errors.
There are a few strategies available:
datadog:
nameSanitizer: raise # defaultThe default strategy is raise, and will raise an exception when a : character is encountered in a metric name.
This will allow you to quickly fix any code under your control which reported these metrics.
Other available strategies are:
escape: replace any:with a-ignore: silently skip reporting the metric with the illegal name