Skip to content

Commit

Permalink
Prepares for 3.0 by updating to Spring Boot 3 and floor Java 8 (#3684)
Browse files Browse the repository at this point in the history
We currently still have a problem as the latest version shows up as 3.0.0-rc0 due to an accidental release. Moreover, a request to delete that version hasn't happened. This switches to 3.x by dropping support for Java 6 and moving to Spring Boot 3.

As noted, recent Zipkin Reporter 3 and Brave 6 decouple instrumentation from this core jar. While it is still in use for other formats, the call sites using them are all minimum Java 8 anyway. By updating to floor Java 8, we can use later JDKs to release than 11, though this change doesn't include doing that, yet.

As Spring Boot requires JRE 17, we update the floor JDK to 17. However, zipkin-dependencies is currently stuck at 11, so until that's not the case, this leaves collector and storage modules at Java 11, even if the server can only run in 17+.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
  • Loading branch information
codefromthecrypt authored Jan 10, 2024
1 parent c89af0a commit e19058d
Show file tree
Hide file tree
Showing 156 changed files with 1,847 additions and 1,718 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-
- name: Cache NPM Packages
uses: actions/cache@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/readme_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
key: ${{ runner.os }}-jdk-21-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-jdk-21-maven-
- name: Execute Server Build # command from zipkin-server/README.md
run: ./mvnw -T1C -q --batch-mode -DskipTests --also-make -pl zipkin-server clean package

Expand Down Expand Up @@ -78,8 +78,8 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
key: ${{ runner.os }}-jdk-21-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-jdk-21-maven-
- name: zipkin-server/README.md # Tests the build which is re-used for a few images
run: ./mvnw -T1C -q --batch-mode -DskipTests --also-make -pl zipkin-server clean package
- name: docker/README.md - openzipkin/zipkin
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,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 @@ -50,7 +50,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 Down Expand Up @@ -104,8 +104,8 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
key: ${{ runner.os }}-jdk-${{ matrix.java_version }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-jdk-${{ matrix.java_version }}-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
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Features include both the collection and lookup of this data.
If you have a trace ID in a log file, you can jump directly to it. Otherwise,
you can query based on attributes such as service, operation name, tags and
duration. Some interesting data will be summarized for you, such as the
percentage of time spent in a service, and whether or not operations failed.
percentage of time spent in a service, and whether operations failed.

<img src="https://zipkin.io/public/img/web-screenshot.png" alt="Trace view screenshot" />

Expand All @@ -30,7 +30,8 @@ Apache Cassandra or Elasticsearch.

## Quick-start

The quickest way to get started is to fetch the [latest released server](https://search.maven.org/remote_content?g=io.zipkin&a=zipkin-server&v=LATEST&c=exec) as a self-contained executable jar. Note that the Zipkin server requires minimum JRE 8. For example:
The quickest way to get started is to fetch the [latest released server](https://search.maven.org/remote_content?g=io.zipkin&a=zipkin-server&v=LATEST&c=exec) as a self-contained
executable jar. Note that the Zipkin server requires minimum JRE 17+. For example:

```bash
curl -sSL https://zipkin.io/quickstart.sh | bash -s
Expand Down Expand Up @@ -66,9 +67,11 @@ docker run -d -p 9411:9411 openzipkin/zipkin-slim
```

## Core Library
The [core library](zipkin/src/main/java/zipkin2) is used by both Zipkin instrumentation and the Zipkin server. Its minimum Java language level is 6, in efforts to support those writing agent instrumentation.
The [core library](zipkin/src/main/java/zipkin2) is used by both Zipkin instrumentation and the Zipkin server.

This includes built-in codec for Zipkin's v1 and v2 json formats. A direct dependency on gson (json library) is avoided by minifying and repackaging classes used. The result is a 155k jar which won't conflict with any library you use.
This includes built-in codec for Zipkin's v1 and v2 json formats. A direct dependency on gson
(json library) is avoided by minifying and repackaging classes used. The result is a 155k jar which
won't conflict with any library you use.

Ex.
```java
Expand All @@ -89,10 +92,18 @@ bytes = SpanBytesEncoder.JSON_V2.encode(span);

Note: The above is just an example, most likely you'll want to use an existing tracing library like [Brave](https://github.com/openzipkin/brave)

### Core Library Requires Java 8+

The minimum Java language level of the core library is 8. This helps support those writing agent
instrumentation. Version 2.x was the last to support Java 6.

*Note*: [zipkin-reporter-brave](https://github.com/openzipkin/zipkin-reporter-java/blob/master/brave/README.md)
does not use this library. So, [brave](https://github.com/openzipkin/brave) still supports Java 6.

## Storage Component
Zipkin includes a [StorageComponent](zipkin/src/main/java/zipkin2/storage/StorageComponent.java), used to store and query spans and
dependency links. This is used by the server and those making collectors, or span reporters. For this reason, storage
components have minimal dependencies, but most require Java 11+
dependency links. This is used by the server and those making collectors, or span reporters.
For this reason, storage components have minimal dependencies, though require Java 11+.

Ex.
```java
Expand All @@ -118,7 +129,7 @@ database needed.

### Cassandra
The [Cassandra](zipkin-server#cassandra-storage) component uses Cassandra
3.11.3+ features, but is tested against the latest patch of Cassandra 3.11.
3.11.3+ features, but is tested against the latest patch of Cassandra 4.1.

This is the second generation of our Cassandra schema. It stores spans
using UDTs, such that they appear like Zipkin v2 json in cqlsh. It is
Expand Down Expand Up @@ -164,7 +175,7 @@ simpler v2 data model currently used.

#### MySQL
The [MySQL v1](zipkin-storage/mysql-v1) component uses MySQL 5.6+
features, but is tested against MariaDB 10.3.
features, but is tested against MariaDB 10.11.

The schema was designed to be easy to understand and get started with;
it was not designed for performance. Ex spans fields are columns, so
Expand All @@ -181,7 +192,7 @@ The [Zipkin server](zipkin-server) receives spans via HTTP POST and respond to q
from its UI. It can also run collectors, such as RabbitMQ or Kafka.

To run the server from the currently checked out source, enter the
following. JDK 11 is required to compile the source.
following. JDK 17+ is required to compile the source.
```bash
# Build the server and also make its dependencies
$ ./mvnw -q --batch-mode -DskipTests --also-make -pl zipkin-server clean install
Expand Down
10 changes: 6 additions & 4 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>io.zipkin</groupId>
<artifactId>zipkin-parent</artifactId>
<version>2.27.2-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>benchmarks</artifactId>
Expand All @@ -29,6 +29,11 @@

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

<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>

<jmh.version>1.37</jmh.version>
<unpack-proto.directory>${project.build.directory}/main/proto</unpack-proto.directory>
</properties>
Expand Down Expand Up @@ -218,9 +223,6 @@
<configuration combine.self="override">
<!-- instead of javac-with-errorprone -->
<compilerId>javac</compilerId>
<source>1.8</source>
<target>1.8</target>
<release>8</release>
<!-- scrub errorprone compiler args -->
<compilerArgs />
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 The OpenZipkin Authors
* Copyright 2015-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 @@ -291,7 +291,7 @@ static void logAndSkip(CodedInputStream input, int tag) throws IOException {
if (DEBUG) { // avoiding volatile reads as we don't log on skip in our normal codec
int nextWireType = WireFormat.getTagWireType(tag);
int nextFieldNumber = WireFormat.getTagFieldNumber(tag);
LOG.fine(String.format("Skipping field: byte=%s, fieldNumber=%s, wireType=%s",
LOG.fine("Skipping field: byte=%s, fieldNumber=%s, wireType=%s".formatted(
input.getTotalBytesRead(), nextFieldNumber, nextWireType));
}
input.skipField(tag);
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/src/main/java/zipkin2/codec/WireSpanDecoder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 The OpenZipkin Authors
* Copyright 2015-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 @@ -306,7 +306,7 @@ static void logAndSkip(ProtoReader input, int tag) throws IOException {
if (DEBUG) { // avoiding volatile reads as we don't log on skip in our normal codec
int nextWireType = WireFormat.getTagWireType(tag);
int nextFieldNumber = WireFormat.getTagFieldNumber(tag);
LOG.fine(String.format("Skipping field: byte=%s, fieldNumber=%s, wireType=%s",
LOG.fine("Skipping field: byte=%s, fieldNumber=%s, wireType=%s".formatted(
0, nextFieldNumber, nextWireType));
}
input.skip();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ServerIntegratedBenchmark {

@Test void elasticsearch() throws Exception {
GenericContainer<?> elasticsearch =
new GenericContainer<>(parse("ghcr.io/openzipkin/zipkin-elasticsearch7:2.26.0"))
new GenericContainer<>(parse("ghcr.io/openzipkin/zipkin-elasticsearch7:2.27.1"))
.withNetwork(Network.SHARED)
.withNetworkAliases("elasticsearch")
.withLabel("name", "elasticsearch")
Expand All @@ -105,7 +105,7 @@ class ServerIntegratedBenchmark {

@Test void cassandra3() throws Exception {
GenericContainer<?> cassandra =
new GenericContainer<>(parse("ghcr.io/openzipkin/zipkin-cassandra:2.26.0"))
new GenericContainer<>(parse("ghcr.io/openzipkin/zipkin-cassandra:2.27.1"))
.withNetwork(Network.SHARED)
.withNetworkAliases("cassandra")
.withLabel("name", "cassandra")
Expand All @@ -119,7 +119,7 @@ class ServerIntegratedBenchmark {

@Test void mysql() throws Exception {
GenericContainer<?> mysql =
new GenericContainer<>(parse("ghcr.io/openzipkin/zipkin-mysql:2.26.0"))
new GenericContainer<>(parse("ghcr.io/openzipkin/zipkin-mysql:2.27.1"))
.withNetwork(Network.SHARED)
.withNetworkAliases("mysql")
.withLabel("name", "mysql")
Expand Down Expand Up @@ -223,29 +223,33 @@ void runBenchmark(@Nullable GenericContainer<?> storage, GenericContainer<?> zip
WebClient prometheusClient = WebClient.of(
"h1c://" + prometheus.getContainerIpAddress() + ":" + prometheus.getFirstMappedPort());

System.out.println(String.format("Messages received: %s", prometheusValue(
System.out.println("Messages received: %s".formatted(prometheusValue(
prometheusClient, "sum(zipkin_collector_messages_total)")));
System.out.println(String.format("Spans received: %s", prometheusValue(
System.out.println("Spans received: %s".formatted(prometheusValue(
prometheusClient, "sum(zipkin_collector_spans_total)")));
System.out.println(String.format("Spans dropped: %s", prometheusValue(
System.out.println("Spans dropped: %s".formatted(prometheusValue(
prometheusClient, "sum(zipkin_collector_spans_dropped_total)")));

System.out.println("Memory quantiles:");
printQuartiles(prometheusClient, "jvm_memory_used_bytes{area=\"heap\"}");
printQuartiles(prometheusClient, "jvm_memory_used_bytes{area=\"nonheap\"}");

System.out.println(String.format("Total GC time (s): %s",
System.out.println("Total GC time (s): %s".formatted(
prometheusValue(prometheusClient, "sum(jvm_gc_pause_seconds_sum)")));
System.out.println(String.format("Number of GCs: %s",
System.out.println("Number of GCs: %s".formatted(
prometheusValue(prometheusClient, "sum(jvm_gc_pause_seconds_count)")));

System.out.println("POST Spans latency (s)");
printHistogram(prometheusClient, "http_server_requests_seconds_bucket{"
+ "method=\"POST\",status=\"202\",uri=\"/api/v2/spans\"}");
printHistogram(prometheusClient, """
http_server_requests_seconds_bucket{
method="POST",status="202",uri="/api/v2/spans"}
""");

if (WAIT_AFTER_BENCHMARK) {
System.out.println("Keeping containers running until explicit termination. "
+ "Feel free to poke around in grafana.");
System.out.println("""
Keeping containers running until explicit termination. \
Feel free to poke around in grafana.\
""");
Thread.sleep(Long.MAX_VALUE);
}
}
Expand Down Expand Up @@ -327,8 +331,8 @@ GenericContainer<?> createZipkinContainer(@Nullable GenericContainer<?> storage)
}

static void printContainerMapping(GenericContainer<?> container) {
System.out.println(String.format(
"Container %s ports exposed at %s",
System.out.println(
"Container %s ports exposed at %s".formatted(
container.getDockerImageName(),
container.getExposedPorts().stream()
.map(port -> new SimpleImmutableEntry<>(port,
Expand All @@ -339,15 +343,15 @@ static void printContainerMapping(GenericContainer<?> container) {
static void printQuartiles(WebClient prometheus, String metric) throws Exception {
for (double quantile : Arrays.asList(0.0, 0.25, 0.5, 0.75, 1.0)) {
String value = prometheusValue(prometheus, "quantile(" + quantile + ", " + metric + ")");
System.out.println(String.format("%s[%s] = %s", metric, quantile, value));
System.out.println("%s[%s] = %s".formatted(metric, quantile, value));
}
}

static void printHistogram(WebClient prometheus, String metric) throws Exception {
for (double quantile : Arrays.asList(0.5, 0.9, 0.99)) {
String value =
prometheusValue(prometheus, "histogram_quantile(" + quantile + ", " + metric + ")");
System.out.println(String.format("%s[%s] = %s", metric, quantile, value));
System.out.println("%s[%s] = %s".formatted(metric, quantile, value));
}
}

Expand Down
4 changes: 2 additions & 2 deletions docker/start-zipkin
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright 2015-2020 The OpenZipkin Authors
# Copyright 2015-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 @@ -40,5 +40,5 @@ else
# Disable Log4j2 JMX extensions when running the full build
exec java ${MODULE_OPTS} ${JAVA_OPTS} -cp . \
-Dlog4j2.disable.jmx=true \
org.springframework.boot.loader.PropertiesLauncher "$@"
org.springframework.boot.loader.launch.PropertiesLauncher "$@"
fi
Loading

0 comments on commit e19058d

Please sign in to comment.