-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: updates main versions notably zipkin (#215)
Signed-off-by: Adrian Cole <[email protected]>
- Loading branch information
1 parent
f530b0d
commit ff1a402
Showing
13 changed files
with
176 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
libthrift/src/test/java/zipkin2/collector/scribe/Access.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
libthrift/src/test/java/zipkin2/reporter/libthrift/ZipkinExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* 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.reporter.libthrift; | ||
|
||
import java.io.IOException; | ||
import okhttp3.OkHttpClient; | ||
import okhttp3.Request; | ||
import okhttp3.Response; | ||
import org.junit.jupiter.api.extension.AfterAllCallback; | ||
import org.junit.jupiter.api.extension.BeforeAllCallback; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
import org.opentest4j.TestAbortedException; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.containers.output.Slf4jLogConsumer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
|
||
import static org.testcontainers.utility.DockerImageName.parse; | ||
|
||
class ZipkinExtension implements BeforeAllCallback, AfterAllCallback { | ||
static final Logger LOGGER = LoggerFactory.getLogger(ZipkinExtension.class); | ||
static final int SCRIBE_PORT = 9410; | ||
static final int HTTP_PORT = 9411; | ||
|
||
final ZipkinContainer container = new ZipkinContainer(); | ||
|
||
@Override public void beforeAll(ExtensionContext context) { | ||
if (context.getRequiredTestClass().getEnclosingClass() != null) { | ||
// Only run once in outermost scope. | ||
return; | ||
} | ||
|
||
container.start(); | ||
LOGGER.info("Using scribe host and port " + host() + ":" + scribePort()); | ||
} | ||
|
||
String host() { | ||
return container.getHost(); | ||
} | ||
|
||
int httpPort() { | ||
return container.getMappedPort(HTTP_PORT); | ||
} | ||
|
||
int scribePort() { | ||
return container.getMappedPort(SCRIBE_PORT); | ||
} | ||
|
||
OkHttpClient client = new OkHttpClient.Builder().followRedirects(true).build(); | ||
|
||
Response get(String path) throws IOException { | ||
return client.newCall(new Request.Builder() | ||
.url("http://" + host() + ":" + httpPort() + path).build()).execute(); | ||
} | ||
|
||
@Override public void afterAll(ExtensionContext context) { | ||
if (context.getRequiredTestClass().getEnclosingClass() != null) { | ||
// Only run once in outermost scope. | ||
return; | ||
} | ||
container.stop(); | ||
} | ||
|
||
// mostly waiting for https://github.com/testcontainers/testcontainers-java/issues/3537 | ||
static final class ZipkinContainer extends GenericContainer<ZipkinContainer> { | ||
ZipkinContainer() { | ||
super(parse("ghcr.io/openzipkin/zipkin:2.24.4")); | ||
if ("true".equals(System.getProperty("docker.skip"))) { | ||
throw new TestAbortedException("${docker.skip} == true"); | ||
} | ||
// zipkin-server disables scribe by default. | ||
withEnv("COLLECTOR_SCRIBE_ENABLED", "true"); | ||
withExposedPorts(SCRIBE_PORT, HTTP_PORT); | ||
waitStrategy = Wait.forHealthcheck(); | ||
withLogConsumer(new Slf4jLogConsumer(LOGGER)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<configuration> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<!-- encoders are assigned the type | ||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> | ||
<encoder> | ||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="WARN"> | ||
<appender-ref ref="STDOUT" /> | ||
</root> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.