Add server name to metrics for Datadog

I use dropwizard metrics with metrics-datadog.

Create reported like this:

HttpTransport httpTransport = new HttpTransport.Builder().withApiKey(API_KEY).build();

DatadogReporter reporter;
reporter = DatadogReporter.forRegistry(metrics)
            .withTransport(httpTransport)
            .withPrefix(PREFIX)
            .withTags(tags)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .filter(MetricFilter.ALL)
            .build();

reporter.start(value, unit);

But there is no host(server name) param in datadog. How can I add host (server name) for metrics to filter them in datadog control panel? Metrics from default datadog agent has server name attribute.

Upvotes: 0

Views: 1165

Answers (1)

Just should set hostname for org.coursera.metrics.datadog.DatadogReporter.Builder:

.withHost(InetAddress.getLocalHost().getCanonicalHostName())

Upvotes: 1

Related Questions