Skip to content

Instantly share code, notes, and snippets.

@qyf404
Last active January 22, 2020 10:04
Show Gist options
  • Save qyf404/dae4836dc980157c0cec461560f5866f to your computer and use it in GitHub Desktop.
Save qyf404/dae4836dc980157c0cec461560f5866f to your computer and use it in GitHub Desktop.
给spring-boot 2.0的项目增加datadog监控
/**
* 这是个可选项, 用来添加一些自定义tag
*/
@Bean
public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags(RcConfig rcConfig) {
return registry -> registry.config()
.commonTags("appname", "myapp",
"nodename", "007");
}
management:
metrics.export.datadog:
apiKey: ${your_datadog_key}
enabled: true
hostTag: ${your_host_name}
step: 10s
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-datadog</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment