Skip to content

Commit

Permalink
Updates to latest versions and swaps undertow for armeria (#151)
Browse files Browse the repository at this point in the history
We had a security vulnerability note about undertow. Since the community
is familiar with Armeria, this makes it a good time to swap. This change
only affects benchmarks.
  • Loading branch information
adriancole authored Jun 25, 2019
1 parent 89e911c commit 8e9927e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 19 deletions.
10 changes: 7 additions & 3 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@
</dependency>

<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
<version>1.4.27.Final</version>
<groupId>com.linecorp.armeria</groupId>
<artifactId>armeria</artifactId>
<version>0.87.0</version>
</dependency>

<dependency>
Expand All @@ -108,6 +108,10 @@
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
40 changes: 26 additions & 14 deletions benchmarks/src/main/java/zipkin2/reporter/HttpSenderBenchmarks.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,39 @@
*/
package zipkin2.reporter;

import io.undertow.Undertow;
import java.io.IOException;
import java.net.InetSocketAddress;
import com.linecorp.armeria.common.HttpResponse;
import com.linecorp.armeria.common.SessionProtocol;
import com.linecorp.armeria.server.Route;
import com.linecorp.armeria.server.Server;
import com.linecorp.armeria.server.ServerBuilder;

import static com.linecorp.armeria.common.HttpMethod.POST;
import static com.linecorp.armeria.common.MediaType.JSON;

public abstract class HttpSenderBenchmarks extends SenderBenchmarks {
Undertow server;
Server server;

@Override protected Sender createSender() throws Exception {
server = Undertow.builder()
.addHttpListener(0, "127.0.0.1")
.setHandler(exchange -> exchange.setStatusCode(202).endExchange()).build();
@Override protected Sender createSender() {
Route v2JsonSpans = Route.builder().methods(POST).consumes(JSON).path("/api/v2/spans").build();
server = new ServerBuilder()
.http(0)
.gracefulShutdownTimeout(0, 0)
.service(v2JsonSpans, (ctx, res) -> HttpResponse.of(202)).build();

server.start();
return newHttpSender("http://127.0.0.1:" +
((InetSocketAddress) server.getListenerInfo().get(0).getAddress()).getPort()
+ "/api/v1/spans");
server.start().join();
return newHttpSender(url("/api/v2/spans"));
}

abstract Sender newHttpSender(String endpoint);

@Override protected void afterSenderClose() throws IOException {
server.stop();
@Override protected void afterSenderClose() {
server.stop().join();
}

String url(String path) {
return server.activePorts().values().stream()
.filter(p -> p.hasProtocol(SessionProtocol.HTTP)).findAny()
.map(p -> "http://127.0.0.1:" + p.localAddress().getPort() + path)
.orElseThrow(() -> new AssertionError("http port not open"));
}
}
2 changes: 1 addition & 1 deletion metrics-micrometer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<!-- Micrometer is Java 1.8 bytecode -->
<main.java.version>1.8</main.java.version>
<main.signature.artifact>java18</main.signature.artifact>
<micrometer.version>1.1.4</micrometer.version>
<micrometer.version>1.1.5</micrometer.version>
</properties>

<dependencies>
Expand Down
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@
<artifactId>mockwebserver</artifactId>
<version>3.14.2</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -160,7 +165,6 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down

0 comments on commit 8e9927e

Please sign in to comment.