Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions metrics-datadog/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -49,7 +49,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dns-cache-manipulator</artifactId>
<version>1.5.1</version>
<version>1.8.3</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package org.coursera.metrics.datadog.transport;

import com.timgroup.statsd.NonBlockingStatsDClient;
import com.timgroup.statsd.NonBlockingStatsDClientBuilder;
import com.timgroup.statsd.StatsDClient;
import com.timgroup.statsd.StatsDClientErrorHandler;
import org.coursera.metrics.datadog.model.DatadogCounter;
import org.coursera.metrics.datadog.model.DatadogGauge;
import org.slf4j.Logger;
Expand Down Expand Up @@ -38,17 +37,13 @@ private UdpTransport(String prefix, String statsdHost, int port, boolean isRetry
socketAddressCallable = staticAddressResolver(statsdHost, port);
}

statsd = new NonBlockingStatsDClient(
prefix,
Integer.MAX_VALUE,
globalTags,
new StatsDClientErrorHandler() {
public void handle(Exception e) {
LOG.error(e.getMessage(), e);
}
},
socketAddressCallable
);
statsd = new NonBlockingStatsDClientBuilder()
.prefix(prefix)
.queueSize(Integer.MAX_VALUE)
.constantTags(globalTags)
.errorHandler(e -> LOG.error(e.getMessage(), e))
.addressLookup(socketAddressCallable)
.build();
}

public void close() throws IOException {
Expand Down Expand Up @@ -156,7 +151,7 @@ public void send() {
// Visible for testing.
static Callable<SocketAddress> staticAddressResolver(final String host, final int port) {
try {
return NonBlockingStatsDClient.staticAddressResolution(host, port);
return NonBlockingStatsDClientBuilder.staticAddressResolution(host, port);
} catch(final Exception e) {
LOG.error("Error during constructing statsd address resolver.", e);
throw new RuntimeException(e);
Expand All @@ -165,6 +160,6 @@ static Callable<SocketAddress> staticAddressResolver(final String host, final in

// Visible for testing.
static Callable<SocketAddress> volatileAddressResolver(final String host, final int port) {
return NonBlockingStatsDClient.volatileAddressResolution(host, port);
return NonBlockingStatsDClientBuilder.volatileAddressResolution(host, port);
}
}
16 changes: 13 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version> <!-- or your current version -->
<configuration>
<argLine>
--add-opens java.base/java.net=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -159,7 +169,7 @@
<dependency>
<groupId>com.datadoghq</groupId>
<artifactId>java-dogstatsd-client</artifactId>
<version>2.6.1</version>
<version>4.4.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand All @@ -175,8 +185,8 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<artifactId>mockito-core</artifactId>
<version>5.19.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down