Skip to content

Commit

Permalink
deps: updates to zipkin 3.0.3 and zipkin-reporter 3.2.1 (#17)
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Cole <[email protected]>
  • Loading branch information
codefromthecrypt authored Jan 15, 2024
1 parent 5e82cb2 commit 64cbe38
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 The OpenZipkin Authors
* Copyright 2019-2024 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -21,13 +21,7 @@
import zipkin2.storage.SpanConsumer;

/** Forwards a list of {@linkplain Span spans} to {@link AsyncReporter#report(Object)}. */
final class ForwarderSpanConsumer implements SpanConsumer {
final AsyncReporter<Span> asyncReporter;

ForwarderSpanConsumer(AsyncReporter<Span> asyncReporter) {
this.asyncReporter = asyncReporter;
}

record ForwarderSpanConsumer(AsyncReporter<Span> asyncReporter) implements SpanConsumer {
@Override public Call<Void> accept(List<Span> spans) {
if (spans.isEmpty()) return Call.create(null);
return new ReporterCall(asyncReporter, spans);
Expand Down
26 changes: 17 additions & 9 deletions core/src/main/java/zipkin2/storage/forwarder/ForwarderStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
*/
package zipkin2.storage.forwarder;

import java.util.Collections;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import zipkin2.Call;
import zipkin2.CheckResult;
import zipkin2.Span;
import zipkin2.reporter.AsyncReporter;
import zipkin2.reporter.BytesMessageSender;
import zipkin2.reporter.ReporterMetrics;
import zipkin2.reporter.Sender;
import zipkin2.storage.AutocompleteTags;
import zipkin2.storage.ServiceAndSpanNames;
import zipkin2.storage.SpanConsumer;
Expand All @@ -32,14 +34,16 @@
* {@link AsyncReporter#report(Object)}.
*/
public final class ForwarderStorage extends StorageComponent {
public static Builder newBuilder(Sender sender) { // visible for testing
public static Builder newBuilder(BytesMessageSender sender) { // visible for testing
return new Builder(sender);
}

public static final class Builder extends StorageComponent.Builder {
final BytesMessageSender sender;
final AsyncReporter.Builder delegate;

Builder(Sender sender) {
Builder(BytesMessageSender sender) {
this.sender = sender;
delegate = AsyncReporter.builder(sender);
}

Expand Down Expand Up @@ -94,14 +98,16 @@ public Builder queuedMaxBytes(int queuedMaxBytes) {
}

@Override public ForwarderStorage build() {
return new ForwarderStorage(delegate.build());
return new ForwarderStorage(this);
}
}

final BytesMessageSender sender;
final AsyncReporter<Span> asyncReporter;

ForwarderStorage(AsyncReporter<Span> asyncReporter) {
this.asyncReporter = asyncReporter;
ForwarderStorage(Builder builder) {
this.sender = builder.sender;
this.asyncReporter = builder.delegate.build();
}

@Override public SpanStore spanStore() {
Expand All @@ -125,11 +131,13 @@ public Builder queuedMaxBytes(int queuedMaxBytes) {
}

@Override public CheckResult check() {
zipkin2.reporter.CheckResult check = asyncReporter.check();
if (check.ok()) {
try {
sender.send(Collections.emptyList());
return CheckResult.OK;
} catch (Throwable t) {
Call.propagateIfFatal(t);
return CheckResult.failed(t);
}
return CheckResult.failed(check.error());
}

@Override public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ITHttpForwarderStorage {

static final class ZipkinContainer extends GenericContainer<ZipkinContainer> {
ZipkinContainer() {
super(parse("ghcr.io/openzipkin/zipkin-slim:3.0.0"));
super(parse("ghcr.io/openzipkin/zipkin-slim:3.0.3"));
waitStrategy = Wait.forHealthcheck();
withExposedPorts(9411);
withLogConsumer(new Slf4jLogConsumer(LOGGER));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class ITKafkaForwarderStorage {
// mostly waiting for https://github.com/testcontainers/testcontainers-java/issues/3537
static final class KafkaContainer extends GenericContainer<KafkaContainer> {
KafkaContainer() {
super(parse("ghcr.io/openzipkin/zipkin-kafka:3.0.0"));
super(parse("ghcr.io/openzipkin/zipkin-kafka:3.0.3"));
waitStrategy = Wait.forHealthcheck();
// 19092 is for connections from the Docker host and needs to be used as a fixed port.
// TODO: someone who knows Kafka well, make ^^ comment better!
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#

# zipkin version should match zipkin.version in /pom.xml
ARG zipkin_version=3.0.0
ARG zipkin_version=3.0.3

# java_version is used during the installation process to build or download the module jar.
#
Expand Down
6 changes: 0 additions & 6 deletions module/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@
<artifactId>zipkin-sender-okhttp3</artifactId>
<version>${zipkin-reporter.version}</version>
</dependency>
<!-- Avoid this error when integrated: Log4j2 could not find a logging implementation. -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>

<dependency>
<groupId>org.apache.kafka</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 The OpenZipkin Authors
* Copyright 2019-2024 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -19,7 +19,7 @@
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import zipkin2.reporter.Sender;
import zipkin2.reporter.BytesMessageSender;
import zipkin2.reporter.kafka.KafkaSender;
import zipkin2.reporter.okhttp3.OkHttpSender;
import zipkin2.storage.StorageComponent;
Expand Down Expand Up @@ -56,8 +56,8 @@ public class ZipkinForwarderStorageModule {
return builder.build();
}

@ConditionalOnBean(Sender.class)
@Bean StorageComponent storage(Sender sender) {
@ConditionalOnBean(BytesMessageSender.class)
@Bean StorageComponent storage(BytesMessageSender sender) {
return ForwarderStorage.newBuilder(sender).build();
}
}
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
<!-- matching armeria/grpc/zipkin -->
<zipkin.groupId>io.zipkin.zipkin2</zipkin.groupId>
<!-- when updating, update docker/Dockerfile and storage/src/test/java/zipkin2/storage/kafka/IT* -->
<zipkin.version>3.0.0</zipkin.version>
<zipkin-reporter.version>3.1.1</zipkin-reporter.version>
<zipkin.version>3.0.3</zipkin.version>
<zipkin-reporter.version>3.2.1</zipkin-reporter.version>
<spring-boot.version>3.2.1</spring-boot.version>
<jackson.version>2.16.1</jackson.version>
<log4j.version>2.21.1</log4j.version>
Expand Down Expand Up @@ -99,7 +99,7 @@
<maven-release-plugin.version>3.0.1</maven-release-plugin.version>
<maven-shade-plugin.version>3.5.1</maven-shade-plugin.version>
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<maven-surefire-plugin.version>3.2.3</maven-surefire-plugin.version>
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
</properties>

Expand Down

0 comments on commit 64cbe38

Please sign in to comment.