Skip to content
Snippets Groups Projects
Commit 55223765 authored by Jon Chambers's avatar Jon Chambers Committed by Jon Chambers
Browse files

Include a host tag with metrics.

parent 5089c37d
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,8 @@ import io.micrometer.datadog.DatadogConfig;
import io.micrometer.datadog.DatadogMeterRegistry;
import io.micrometer.wavefront.WavefrontConfig;
import io.micrometer.wavefront.WavefrontMeterRegistry;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.net.http.HttpClient;
import java.time.Duration;
import java.util.ArrayList;
......@@ -272,6 +274,19 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
});
{
final String host;
{
String localHostName = "unknown";
try {
localHostName = InetAddress.getLocalHost().getHostName();
} catch (final UnknownHostException ignored) {
}
host = localHostName;
}
final DatadogMeterRegistry datadogMeterRegistry = new DatadogMeterRegistry(new DatadogConfig() {
@Override
public String get(final String key) {
......@@ -287,6 +302,11 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
public Duration step() {
return config.getDatadogConfiguration().getStep();
}
@Override
public String hostTag() {
return host;
}
}, Clock.SYSTEM);
datadogMeterRegistry.config().meterFilter(new MeterFilter() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment