Skip to content

Commit

Permalink
Add support for elasticsearch 8
Browse files Browse the repository at this point in the history
  • Loading branch information
fazil authored and shakuzen committed Aug 28, 2023
1 parent 1acbc86 commit a38c405
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public final class ElasticsearchVersion implements Comparable<ElasticsearchVersi
public static final ElasticsearchVersion V7_0 = new ElasticsearchVersion(7, 0);
public static final ElasticsearchVersion V7_8 = new ElasticsearchVersion(7, 8);
public static final ElasticsearchVersion V8_0 = new ElasticsearchVersion(8, 0);
public static final ElasticsearchVersion V9_0 = new ElasticsearchVersion(9, 0);

static ElasticsearchVersion get(HttpCall.Factory http) throws IOException {
return Parser.INSTANCE.get(http);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static zipkin2.elasticsearch.ElasticsearchVersion.V7_0;
import static zipkin2.elasticsearch.ElasticsearchVersion.V7_8;
import static zipkin2.elasticsearch.ElasticsearchVersion.V8_0;
import static zipkin2.elasticsearch.ElasticsearchVersion.V9_0;

/** Returns version-specific index templates */
// TODO: make a main class that spits out the index template using ENV variables for the server,
Expand Down Expand Up @@ -223,7 +224,7 @@ String autocompleteTemplate(ElasticsearchVersion version) {
}

IndexTemplates get(ElasticsearchVersion version) {
if (version.compareTo(V5_0) < 0 || version.compareTo(V8_0) >= 0) {
if (version.compareTo(V5_0) < 0 || version.compareTo(V9_0) >= 0) {
throw new IllegalArgumentException(
"Elasticsearch versions 5-7.x are supported, was: " + version);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2015-2020 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.integration;

import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.extension.RegisterExtension;
import zipkin2.elasticsearch.ElasticsearchStorage;

import static zipkin2.elasticsearch.integration.ElasticsearchExtension.index;

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class ITElasticsearchStorageV8 extends ITElasticsearchStorage {

@RegisterExtension ElasticsearchExtension elasticsearch = new ElasticsearchExtension(8);

@Override ElasticsearchExtension elasticsearch() {
return elasticsearch;
}

@Nested
class ITEnsureIndexTemplate extends zipkin2.elasticsearch.integration.ITEnsureIndexTemplate {
@Override protected ElasticsearchStorage.Builder newStorageBuilder(TestInfo testInfo) {
return elasticsearch().computeStorageBuilder().index(index(testInfo));
}
}
}

0 comments on commit a38c405

Please sign in to comment.