Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Chore/upgrade to dropwizard 3 #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion dropwizard-metrics-datadog/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>metrics-datadog-parent</artifactId>
<groupId>org.coursera</groupId>
<version>2.0.0-RC1</version>
<version>3.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.dropwizard.metrics;
package io.dropwizard.metrics.common;

import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.ScheduledReporter;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.dropwizard.metrics.common.DatadogReporterFactory
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.dropwizard.metrics;
package io.dropwizard.metrics.common;

import io.dropwizard.jackson.DiscoverableSubtypeResolver;
import org.fest.assertions.api.Assertions;
Expand Down
21 changes: 17 additions & 4 deletions metrics-datadog/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.coursera</groupId>
<artifactId>metrics-datadog-parent</artifactId>
<version>2.0.0-RC1</version>
<version>3.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down 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,9 +49,22 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dns-cache-manipulator</artifactId>
<version>1.5.1</version>
<version>1.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>add-java-open-options-for-jdk16+</id>
<activation>
<jdk>[16,)</jdk>
</activation>
<properties>
<argLine>
--add-opens java.base/java.net=ALL-UNNAMED
--add-opens java.base/sun.net=ALL-UNNAMED
</argLine>
</properties>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -1,6 +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;
Expand Down Expand Up @@ -38,17 +39,12 @@ 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(new StatsDClientErrorHandler() {
public void handle(Exception e) {
LOG.error(e.getMessage(), e);
}
}).addressLookup(socketAddressCallable).build();
}

public void close() throws IOException {
Expand Down Expand Up @@ -156,7 +152,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 +161,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);
}
}
42 changes: 24 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
<version>9</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<groupId>org.coursera</groupId>
<artifactId>metrics-datadog-parent</artifactId>
<version>2.0.0-RC1</version>
<version>3.0.0</version>
<packaging>pom</packaging>
<name>Datadog Metrics Parent</name>
<url>https://github.com/coursera/metrics-datadog</url>
Expand Down Expand Up @@ -39,6 +40,10 @@
</developer>
</developers>
<contributors>
<contributor>
<name>Mustafa Shabib</name>
<email>mshabib (at) seasonhealth.com</email>
</contributor>
<contributor>
<name>Ankur Chauhan</name>
<email>ankur (at) malloc64.com</email>
Expand All @@ -55,16 +60,16 @@
</contributor>
</contributors>
<properties>
<metrics.version>4.0.2</metrics.version>
<jackson.version>2.9.6</jackson.version>
<dropwizard.version>1.3.4</dropwizard.version>
<metrics.version>4.2.18</metrics.version>
<jackson.version>2.15.1</jackson.version>
<dropwizard.version>3.0.0</dropwizard.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand All @@ -73,12 +78,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -91,14 +96,16 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<version>3.5.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<additionalOptions>-Xdoclint:none</additionalOptions>
<additionalJOption>-Xdoclint:none</additionalJOption>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</execution>
Expand Down Expand Up @@ -131,7 +138,6 @@
</plugin>
</plugins>
</build>

<dependencyManagement>
<dependencies>
<dependency>
Expand All @@ -149,22 +155,22 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>fluent-hc</artifactId>
<version>4.5.5</version>
<version>4.5.14</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
</dependency>
<dependency>
<groupId>com.datadoghq</groupId>
<artifactId>java-dogstatsd-client</artifactId>
<version>2.6.1</version>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -175,14 +181,14 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<artifactId>mockito-core</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.25</version>
<version>2.0.7</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down