Skip to content

Instantly share code, notes, and snippets.

@jkschneider
Created January 30, 2019 16:06
Show Gist options
  • Save jkschneider/796471c7a0b28b6076584e179b333019 to your computer and use it in GitHub Desktop.
Save jkschneider/796471c7a0b28b6076584e179b333019 to your computer and use it in GitHub Desktop.
Wiring for Datadog in Spring MVC
@Bean
MeterRegistry registry() {
MeterRegistry registry = new DatadogMeterRegistry(new DatadogConfig() {
@Override
public String apiKey() {
return "";
}
@Override
public String applicationKey() {
return "";
}
@Override
public String get(String key) {
return System.getProperty(key);
}
}, Clock.SYSTEM);
new JvmGcMetrics().bindTo(registry);
new ProcessorMetrics().bindTo(registry);
return registry;
}
@jkschneider
Copy link
Author

You're responsible for instrumenting HTTP endpoints yourself using this model. You can refer to this filter which is how Spring Boot does it, and recreate it as necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment