Skip to content

Commit

Permalink
Updates to Zipkin 3, Spring Boot 3 and JRE 17
Browse files Browse the repository at this point in the history
This updates server modules to Zipkin 3, Spring Boot 3 and JRE 17. It
leaves the client side modules at Java 8.

In order to compile the server module, we can no longer compile with
JDK 11.

See openzipkin/zipkin#3684

Signed-off-by: Adrian Cole <adrian@tetrate.io>
  • Loading branch information
Adrian Cole committed Jan 10, 2024
1 parent 62b971f commit 22027f0
Show file tree
Hide file tree
Showing 31 changed files with 387 additions and 305 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu' # zulu as it supports a wide version range
java-version: '11' # earliest LTS and last that can compile the 1.6 release profile.
java-version: '17' # earliest LTS and last that can compile the 1.6 release profile.
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
key: ${{ runner.os }}-jdk-11-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-jdk-11-maven-
- name: Create Release
env:
# GH_USER=<user that created GH_TOKEN>
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu' # zulu as it supports a wide version range
java-version: '11' # earliest LTS and last that can compile the 1.6 release profile.
java-version: '17' # earliest LTS supported by Spring Boot 3
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
key: ${{ runner.os }}-jdk-17-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-jdk-17-maven-
# Don't attempt to cache Docker. Sensitive information can be stolen
# via forks, and login session ends up in ~/.docker. This is ok because
# we publish DOCKER_PARENT_IMAGE to ghcr.io, hence local to the runner.
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu' # zulu as it supports a wide version range
java-version: '11' # earliest LTS and last that can compile the 1.6 release profile.
java-version: '17' # earliest LTS supported by Spring Boot 3
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-jdk-11-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-jdk-11-maven-
key: ${{ runner.os }}-jdk-17-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-jdk-17-maven-
- name: Build JavaDoc
run: ./mvnw clean javadoc:aggregate -Prelease

Expand All @@ -46,7 +46,7 @@ jobs:
fail-fast: false # don't fail fast as sometimes failures are operating system specific
matrix: # use latest available versions and be consistent on all workflows!
include:
- java_version: 11 # Last that can compile zipkin core to 1.6 for zipkin-reporter
- java_version: 17 # earliest LTS supported by Spring Boot 3
maven_args: -Prelease -Dgpg.skip -Dmaven.javadoc.skip=true
- java_version: 21 # Most recent LTS
steps:
Expand All @@ -69,4 +69,4 @@ jobs:
# via forks, and login session ends up in ~/.docker. This is ok because
# we publish DOCKER_PARENT_IMAGE to ghcr.io, hence local to the runner.
- name: Test
run: build-bin/configure_test && build-bin/test
run: build-bin/configure_test && build-bin/test ${{ matrix.maven_args }}
5 changes: 5 additions & 0 deletions aws-junit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@

<properties>
<main.basedir>${project.basedir}/..</main.basedir>

<!-- Only used in this repo's tests, which use floor JDK 17 -->
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public AmazonSQSExtension() {
client = AmazonSQSClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("x", "x")))
.withEndpointConfiguration(
new EndpointConfiguration(String.format("http://localhost:%d", serverPort), null))
new EndpointConfiguration("http://localhost:%d".formatted(serverPort), null))
.build();
queueUrl = client.createQueue("zipkin").getQueueUrl();
}
Expand All @@ -75,7 +75,7 @@ public AmazonSQSExtension() {
client = null;
}

if (server == null) {
if (server != null) {
server.stopAndWait();
server = null;
}
Expand Down Expand Up @@ -112,7 +112,7 @@ public List<Span> getSpans(boolean delete) {

ReceiveMessageResult result = client.receiveMessage(queueUrl);

while (result != null && result.getMessages().size() > 0) {
while (result != null && !result.getMessages().isEmpty()) {

spans = Stream.concat(spans,
result.getMessages().stream().flatMap(AmazonSQSExtension::decodeSpans));
Expand All @@ -123,7 +123,7 @@ public List<Span> getSpans(boolean delete) {
List<DeleteMessageRequest> deletes = result.getMessages()
.stream()
.map(m -> new DeleteMessageRequest(queueUrl, m.getReceiptHandle()))
.collect(Collectors.toList());
.toList();
deletes.forEach(d -> client.deleteMessage(d));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AwsClientTracingTest extends ITRemote {
public MockWebServer mockServer = new MockWebServer();

@SystemStub
private EnvironmentVariables variables = new EnvironmentVariables();
private final EnvironmentVariables variables = new EnvironmentVariables();
private AmazonDynamoDB dbClient;
private AmazonS3 s3Client;

Expand All @@ -68,7 +68,7 @@ class AwsClientTracingTest extends ITRemote {
.enableForceGlobalBucketAccess());
}

@Test void testSpanCreatedAndTagsApplied() throws InterruptedException {
@Test void testSpanCreatedAndTagsApplied() {
mockServer.enqueue(createDeleteItemResponse());

dbClient.deleteItem("test", Collections.singletonMap("key", new AttributeValue("value")));
Expand All @@ -89,7 +89,7 @@ class AwsClientTracingTest extends ITRemote {
AwsClientTracing.create(httpTracing).build(AmazonDynamoDBAsyncClientBuilder.standard());
}

@Test void testInternalAwsRequestsDoNotThrowNPE() throws InterruptedException {
@Test void testInternalAwsRequestsDoNotThrowNPE() {
// Responds to the internal HEAD request
mockServer.enqueue(new MockResponse()
.setResponseCode(400)
Expand Down Expand Up @@ -125,22 +125,23 @@ private MockResponse createDeleteItemResponse() {
}

private MockResponse getExistsResponse() {
return new MockResponse().setBody("<AccessControlPolicy>\n"
+ " <Owner>\n"
+ " <ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>\n"
+ " <DisplayName>CustomersName@amazon.com</DisplayName>\n"
+ " </Owner>\n"
+ " <AccessControlList>\n"
+ " <Grant>\n"
+ " <Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ "\t\t\txsi:type=\"CanonicalUser\">\n"
+ " <ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>\n"
+ " <DisplayName>CustomersName@amazon.com</DisplayName>\n"
+ " </Grantee>\n"
+ " <Permission>FULL_CONTROL</Permission>\n"
+ " </Grant>\n"
+ " </AccessControlList>\n"
+ "</AccessControlPolicy> ")
return new MockResponse().setBody("""
<AccessControlPolicy>
<Owner>
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>CustomersName@amazon.com</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CanonicalUser">
<ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID>
<DisplayName>CustomersName@amazon.com</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>""")
.setResponseCode(200)
.addHeader("x-amz-request-id", "abcd");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
/**
* Traces AWS Java SDK V2 calls. Adds on the standard zipkin/brave http tags, as well as tags that
* align with the XRay data model.
*
* <p>
* This implementation creates 2 types of spans to allow for better error visibility.
*
* <p>
* The outer span, "Application Span", wraps the whole SDK operation. This span uses the AWS service
* as it's name and will NOT have a remoteService configuration, making it a local span. If the
* entire operation results in an error then this span will have an error tag with the cause.
*
* <p>
* The inner span, "Client Span", is created for each outgoing HTTP request. This span will be of
* type CLIENT. The remoteService will be the name of the AWS service, and the span name will be the
* name of the operation being done. If the request results in an error then the span will be tagged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ class AWSPropagationTest {
@Test void traceIdWhenPassThrough() {
carrier.put(
"x-amzn-trace-id",
"Robot=Hello;Self=1-582113d1-1e48b74b3603af8479078ed6; "
+ "Root=1-58211399-36d228ad5d99923122bbe354; "
+ "TotalTimeSoFar=112ms;CalledFrom=Foo");
"""
Robot=Hello;Self=1-582113d1-1e48b74b3603af8479078ed6; \
Root=1-58211399-36d228ad5d99923122bbe354; \
TotalTimeSoFar=112ms;CalledFrom=Foo\
""");

TraceContext context = contextWithPassThrough();

Expand Down Expand Up @@ -186,9 +188,11 @@ TraceContext contextWithPassThrough() {
// we currently permit them
carrier.put(
"x-amzn-trace-id",
"Robot=Hello;Self=1-582113d1-1e48b74b3603af8479078ed6; "
+ "Root=1-58211399-36d228ad5d99923122bbe354; "
+ "TotalTimeSoFar=112ms;CalledFrom=Foo");
"""
Robot=Hello;Self=1-582113d1-1e48b74b3603af8479078ed6; \
Root=1-58211399-36d228ad5d99923122bbe354; \
TotalTimeSoFar=112ms;CalledFrom=Foo\
""");

TraceContextOrSamplingFlags extracted = extractor.extract(carrier);
assertThat(extracted.traceIdContext())
Expand Down
5 changes: 5 additions & 0 deletions collector/kinesis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@

<properties>
<main.basedir>${project.basedir}/../..</main.basedir>

<!-- Only used in zipkin-server, which has floor JRE 17 -->
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 The OpenZipkin Authors
* Copyright 2016-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 Down Expand Up @@ -103,9 +103,8 @@ public KinesisCollector build() {

private final Executor executor;
private Worker worker;
private IRecordProcessorFactory processor;

KinesisCollector(Builder builder) {
KinesisCollector(Builder builder) {
this.collector = builder.delegate.build();
this.metrics = builder.metrics;
this.appName = builder.appName;
Expand Down Expand Up @@ -133,7 +132,7 @@ public KinesisCollector start() {
new KinesisClientLibConfiguration(appName, streamName, credentialsProvider, workerId);
config.withRegionName(regionName);

processor = new KinesisRecordProcessorFactory(collector, metrics);
IRecordProcessorFactory processor = new KinesisRecordProcessorFactory(collector, metrics);
worker = new Worker.Builder().recordProcessorFactory(processor).config(config).build();

executor.execute(worker);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 The OpenZipkin Authors
* Copyright 2016-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 @@ -23,14 +23,15 @@
import zipkin2.collector.CollectorMetrics;

final class KinesisSpanProcessor implements IRecordProcessor {
static final Callback<Void> NOOP =
new Callback<Void>() {
@Override
public void onSuccess(Void value) {}
static final Callback<Void> NOOP = new Callback<>() {
@Override
public void onSuccess(Void value) {
}

@Override
public void onError(Throwable t) {}
};
@Override
public void onError(Throwable t) {
}
};

final Collector collector;
final CollectorMetrics metrics;
Expand All @@ -41,7 +42,8 @@ public void onError(Throwable t) {}
}

@Override
public void initialize(InitializationInput initializationInput) {}
public void initialize(InitializationInput initializationInput) {
}

@Override
public void processRecords(ProcessRecordsInput processRecordsInput) {
Expand All @@ -54,5 +56,6 @@ public void processRecords(ProcessRecordsInput processRecordsInput) {
}

@Override
public void shutdown(ShutdownInput shutdownInput) {}
public void shutdown(ShutdownInput shutdownInput) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class KinesisSpanProcessorTest {
TestObjects.LOTS_OF_SPANS[0], TestObjects.LOTS_OF_SPANS[1], TestObjects.LOTS_OF_SPANS[2]);

private InMemoryStorage storage;
private InMemoryCollectorMetrics metrics = new InMemoryCollectorMetrics();
private final InMemoryCollectorMetrics metrics = new InMemoryCollectorMetrics();

private Collector collector;
private KinesisSpanProcessor kinesisSpanProcessor;
Expand Down Expand Up @@ -80,7 +80,7 @@ class KinesisSpanProcessorTest {
void messageWithMultipleSpans(SpanBytesEncoder encoder) {
byte[] message = encoder.encodeList(spans);

List<Record> records = Arrays.asList(new Record().withData(ByteBuffer.wrap(message)));
List<Record> records = Collections.singletonList(new Record().withData(ByteBuffer.wrap(message)));
kinesisSpanProcessor.processRecords(new ProcessRecordsInput().withRecords(records));

assertThat(storage.spanStore().getTraces().size()).isEqualTo(spans.size());
Expand Down
5 changes: 5 additions & 0 deletions collector/sqs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@

<properties>
<main.basedir>${project.basedir}/../..</main.basedir>

<!-- Only used in zipkin-server, which has floor JRE 17 -->
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
</properties>

<dependencies>
Expand Down
Loading

0 comments on commit 22027f0

Please sign in to comment.