Skip to content

Commit

Permalink
Moves to JDK 11
Browse files Browse the repository at this point in the history
This moves to JDK 11 and stops as further progress is tangled with
Elastisearch driver updates, which we can do after we remove support for
ES 6.

Signed-off-by: Adrian Cole <[email protected]>
  • Loading branch information
Adrian Cole committed Dec 7, 2023
1 parent faa77c1 commit faaf2bc
Show file tree
Hide file tree
Showing 18 changed files with 483 additions and 381 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu' # zulu as it supports a wide version range
java-version: '8' # last LTS that works with Spark <3.0
java-version: '11' # Most recent LTS that passes tests
- name: Cache local Maven repository
uses: actions/cache@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu' # zulu as it supports a wide version range
java-version: '8' # last LTS that works with Spark <3.0
java-version: '11' # Most recent LTS that passes tests
- name: Cache local Maven repository
uses: actions/cache@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/readme_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu' # zulu as it supports a wide version range
java-version: '8' # last LTS that works with Spark <3.0
java-version: '11' # Most recent LTS that passes tests
- name: Cache local Maven repository
uses: actions/cache@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu' # zulu as it supports a wide version range
java-version: '8' # last LTS that works with Spark <3.0
java-version: '11' # Most recent LTS that passes tests
- name: Test without Docker
run: build-bin/maven/maven_go_offline && build-bin/test -Ddocker.skip=true
test_docker:
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu' # zulu as it supports a wide version range
java-version: '8' # last LTS that works with Spark <3.0
java-version: '11' # Most recent LTS that passes tests
- name: Test with Docker
run: |
build-bin/configure_test &&
Expand Down
Binary file modified .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
20 changes: 18 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 The OpenZipkin Authors
* Copyright 2016-2023 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 @@ -57,7 +57,7 @@ public class CassandraExtension implements BeforeAllCallback, AfterAllCallback {
TABLE_TRACE_BY_SERVICE_SPAN
);

CassandraContainer container = new CassandraContainer();
final CassandraContainer container = new CassandraContainer();
CqlSession globalSession;

@Override public void beforeAll(ExtensionContext context) {
Expand Down Expand Up @@ -169,10 +169,11 @@ static boolean poolInFlight(CqlSession session) {
// mostly waiting for https://github.com/testcontainers/testcontainers-java/issues/3537
static final class CassandraContainer extends GenericContainer<CassandraContainer> {
CassandraContainer() {
super(parse("ghcr.io/openzipkin/zipkin-cassandra:2.23.2"));
super(parse("ghcr.io/openzipkin/zipkin-cassandra:2.24.4"));
if ("true".equals(System.getProperty("docker.skip"))) {
throw new TestAbortedException("${docker.skip} == true");
}
addExposedPort(9042);
waitStrategy = Wait.forHealthcheck();
withLogConsumer(new Slf4jLogConsumer(LOGGER));
}
Expand Down
3 changes: 1 addition & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ ENV VERSION=$version
ENV MAVEN_PROJECT_BASEDIR=/code
RUN /code/build-bin/maven/maven_build_or_unjar io.zipkin.dependencies zipkin-dependencies ${VERSION}

# Until Elasticsearch upgrades their driver, we are stuck on JRE 8
FROM ghcr.io/openzipkin/java:8.392.08-jre as zipkin-dependencies
FROM ghcr.io/openzipkin/java:11.0.21_p9-jre as zipkin-dependencies
LABEL org.opencontainers.image.description="Zipkin Dependencies Aggregator on OpenJDK and Alpine Linux"
LABEL org.opencontainers.image.source=https://github.com/openzipkin/zipkin-dependencies

Expand Down
2 changes: 1 addition & 1 deletion docker/periodic/daily/zipkin-dependencies-yesterday
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright 2016-2021 The OpenZipkin Authors
# Copyright 2016-2023 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
2 changes: 1 addition & 1 deletion docker/periodic/hourly/zipkin-dependencies-today
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright 2016-2021 The OpenZipkin Authors
# Copyright 2016-2023 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
8 changes: 7 additions & 1 deletion elasticsearch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<properties>
<main.basedir>${project.basedir}/..</main.basedir>
<okhttp.version>4.9.0</okhttp.version>
<okhttp.version>4.12.0</okhttp.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -56,6 +56,12 @@
<version>${okhttp.version}</version>
<scope>test</scope>
</dependency>
<!-- Temporarily override ES verson of SLF4J -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>

<!-- integration tests -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 The OpenZipkin Authors
* Copyright 2016-2023 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 @@ -14,10 +14,16 @@
package zipkin2.elasticsearch;

import com.linecorp.armeria.client.ClientFactory;
import com.linecorp.armeria.client.ClientOptions;
import com.linecorp.armeria.client.ClientOptionsBuilder;
import com.linecorp.armeria.client.WebClient;
import com.linecorp.armeria.client.WebClientBuilder;
import com.linecorp.armeria.client.logging.ContentPreviewingClient;
import com.linecorp.armeria.client.logging.LoggingClient;
import com.linecorp.armeria.client.logging.LoggingClientBuilder;
import com.linecorp.armeria.common.HttpResponse;
import com.linecorp.armeria.common.logging.LogLevel;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
Expand All @@ -30,6 +36,7 @@
import zipkin2.elasticsearch.ElasticsearchStorage.Builder;

import static org.testcontainers.utility.DockerImageName.parse;
import static zipkin2.elasticsearch.IgnoredDeprecationWarnings.IGNORE_THESE_WARNINGS;

class ElasticsearchExtension implements BeforeAllCallback, AfterAllCallback {
static final Logger LOGGER = LoggerFactory.getLogger(ElasticsearchExtension.class);
Expand Down Expand Up @@ -66,12 +73,36 @@ Builder computeStorageBuilder() {
//
// TODO: find or raise a bug with Elastic
.factory(ClientFactory.builder().useHttp2Preface(false).build());
builder.decorator((delegate, ctx, req) -> {
final HttpResponse response = delegate.execute(ctx, req);
return HttpResponse.from(response.aggregate().thenApply(r -> {
// ES will return a 'warning' response header when using deprecated api, detect this and
// fail early so we can do something about it.
// Example usage: https://github.com/elastic/elasticsearch/blob/3049e55f093487bb582a7e49ad624961415ba31c/x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/integration/IndexPrivilegeIntegTests.java#L559
final String warningHeader = r.headers().get("warning");
if (warningHeader != null) {
if (IGNORE_THESE_WARNINGS.stream().noneMatch(p -> p.matcher(warningHeader).find())) {
throw new IllegalArgumentException("Detected usage of deprecated API for request "
+ req.toString() + ":\n" + warningHeader);
}
}
// Convert AggregatedHttpResponse back to HttpResponse.
return r.toHttpResponse();
}));
});

// When ES_DEBUG=true log full headers, request and response body to the category
// com.linecorp.armeria.client.logging
if (Boolean.parseBoolean(System.getenv("ES_DEBUG"))) {
builder.decorator(c -> LoggingClient.builder()
ClientOptionsBuilder options = ClientOptions.builder();
LoggingClientBuilder loggingBuilder = LoggingClient.builder()
.requestLogLevel(LogLevel.INFO)
.successfulResponseLogLevel(LogLevel.INFO).build(c));
.successfulResponseLogLevel(LogLevel.INFO);
options.decorator(loggingBuilder.newDecorator());
options.decorator(ContentPreviewingClient.newDecorator(Integer.MAX_VALUE));
builder.options(options.build());
}

WebClient client = builder.build();
return ElasticsearchStorage.newBuilder(new ElasticsearchStorage.LazyHttpClient() {
@Override public WebClient get() {
Expand All @@ -95,10 +126,11 @@ String hostPort() {
// mostly waiting for https://github.com/testcontainers/testcontainers-java/issues/3537
static final class ElasticsearchContainer extends GenericContainer<ElasticsearchContainer> {
ElasticsearchContainer(int majorVersion) {
super(parse("ghcr.io/openzipkin/zipkin-elasticsearch" + majorVersion + ":2.23.2"));
super(parse("ghcr.io/openzipkin/zipkin-elasticsearch" + majorVersion + ":2.24.4"));
if ("true".equals(System.getProperty("docker.skip"))) {
throw new TestAbortedException("${docker.skip} == true");
}
addExposedPort(9200);
waitStrategy = Wait.forHealthcheck();
withLogConsumer(new Slf4jLogConsumer(LOGGER));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2016-2023 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package zipkin2.elasticsearch;

import java.util.List;
import java.util.regex.Pattern;

import static java.util.Arrays.asList;
import static java.util.regex.Pattern.compile;

/**
* When ES emits a deprecation warning header in response to a method being called, the integration
* test will fail. We cannot always fix our code however to take into account all deprecation
* warnings, as we have to support multiple versions of ES. For these cases, add the warning message
* to {@link #IGNORE_THESE_WARNINGS} array so it will not raise an exception anymore.
*/
abstract class IgnoredDeprecationWarnings {

// These will be matched using header.contains(ignored[i]), so find a unique substring of the
// warning header for it to be ignored
static List<Pattern> IGNORE_THESE_WARNINGS = asList(
compile("Elasticsearch 7\\.x will read, but not allow creation of new indices containing ':'"),
compile("has index patterns \\[.*] matching patterns from existing older templates"),
compile("has index patterns \\[.*] matching patterns from existing composable templates")
);
}
Loading

0 comments on commit faaf2bc

Please sign in to comment.