Bumping versions

This commit is contained in:
buildmaster
2020-09-17 05:29:17 +00:00
parent ff44daa2bd
commit 05461159eb
276 changed files with 2590 additions and 4452 deletions

View File

@@ -35,8 +35,7 @@ import org.springframework.web.client.RestTemplate;
* @author Spencer Gibb
*/
@RestController
public class SampleController
implements ApplicationListener<ServletWebServerInitializedEvent> {
public class SampleController implements ApplicationListener<ServletWebServerInitializedEvent> {
private static final Log log = LogFactory.getLog(SampleController.class);
@@ -57,8 +56,7 @@ public class SampleController
public String hi() throws InterruptedException {
Thread.sleep(this.random.nextInt(1000));
log.info("Home page");
String s = this.restTemplate
.getForObject("http://localhost:" + this.port + "/hi2", String.class);
String s = this.restTemplate.getForObject("http://localhost:" + this.port + "/hi2", String.class);
return "hi/" + s;
}
@@ -100,8 +98,7 @@ public class SampleController
Thread.sleep(millis);
this.tracer.currentSpan().tag("random-sleep-millis", String.valueOf(millis));
String s = this.restTemplate
.getForObject("http://localhost:" + this.port + "/call", String.class);
String s = this.restTemplate.getForObject("http://localhost:" + this.port + "/call", String.class);
span.finish();
return "traced/" + s;
}
@@ -112,8 +109,7 @@ public class SampleController
log.info(String.format("Sleeping for [%d] millis", millis));
Thread.sleep(millis);
this.tracer.currentSpan().tag("random-sleep-millis", String.valueOf(millis));
String s = this.restTemplate
.getForObject("http://localhost:" + this.port + "/call", String.class);
String s = this.restTemplate.getForObject("http://localhost:" + this.port + "/call", String.class);
return "start/" + s;
}

View File

@@ -51,8 +51,7 @@ import org.springframework.test.context.TestPropertySource;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.BDDAssertions.then;
@SpringBootTest(
classes = { WaitUntilZipkinIsUpConfig.class, SampleZipkinApplication.class },
@SpringBootTest(classes = { WaitUntilZipkinIsUpConfig.class, SampleZipkinApplication.class },
webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@TestPropertySource(properties = { "sample.zipkin.enabled=true" })
public class ZipkinTests extends AbstractIntegrationTest {
@@ -90,9 +89,8 @@ public class ZipkinTests extends AbstractIntegrationTest {
long traceId = new Random().nextLong();
await().atMost(10, SECONDS)
.untilAsserted(() -> httpMessageWithTraceIdInHeadersIsSuccessfullySent(
this.sampleAppUrl + "/hi2", traceId).run());
await().atMost(10, SECONDS).untilAsserted(
() -> httpMessageWithTraceIdInHeadersIsSuccessfullySent(this.sampleAppUrl + "/hi2", traceId).run());
spansSentToZipkin(zipkin, traceId);
}
@@ -101,20 +99,15 @@ public class ZipkinTests extends AbstractIntegrationTest {
return APP_NAME;
}
void spansSentToZipkin(MockWebServer zipkin, long traceId)
throws InterruptedException {
void spansSentToZipkin(MockWebServer zipkin, long traceId) throws InterruptedException {
RecordedRequest request = zipkin.takeRequest();
List<Span> spans = SpanBytesDecoder.JSON_V2
.decodeList(request.getBody().readByteArray());
List<Span> spans = SpanBytesDecoder.JSON_V2.decodeList(request.getBody().readByteArray());
List<String> traceIdsNotFoundInZipkin = traceIdsNotFoundInZipkin(spans, traceId);
List<String> serviceNamesNotFoundInZipkin = serviceNamesNotFoundInZipkin(spans);
List<String> tagsNotFoundInZipkin = hasRequiredTag(spans);
log.info(String.format("The following trace IDs were not found in Zipkin %s",
traceIdsNotFoundInZipkin));
log.info(String.format("The following services were not found in Zipkin %s",
serviceNamesNotFoundInZipkin));
log.info(String.format("The following tags were not found in Zipkin %s",
tagsNotFoundInZipkin));
log.info(String.format("The following trace IDs were not found in Zipkin %s", traceIdsNotFoundInZipkin));
log.info(String.format("The following services were not found in Zipkin %s", serviceNamesNotFoundInZipkin));
log.info(String.format("The following tags were not found in Zipkin %s", tagsNotFoundInZipkin));
then(traceIdsNotFoundInZipkin).isEmpty();
then(serviceNamesNotFoundInZipkin).isEmpty();
then(tagsNotFoundInZipkin).isEmpty();
@@ -123,17 +116,15 @@ public class ZipkinTests extends AbstractIntegrationTest {
List<String> traceIdsNotFoundInZipkin(List<Span> spans, long traceId) {
String traceIdString = SpanUtil.idToHex(traceId);
Optional<String> traceIds = spans.stream().map(Span::traceId)
.filter(traceIdString::equals).findFirst();
return traceIds.isPresent() ? Collections.emptyList()
: Collections.singletonList(traceIdString);
Optional<String> traceIds = spans.stream().map(Span::traceId).filter(traceIdString::equals).findFirst();
return traceIds.isPresent() ? Collections.emptyList() : Collections.singletonList(traceIdString);
}
List<String> serviceNamesNotFoundInZipkin(List<Span> spans) {
List<String> localServiceNames = spans.stream().map(Span::localServiceName)
.filter(Objects::nonNull).distinct().collect(Collectors.toList());
List<String> remoteServiceNames = spans.stream().map(Span::remoteServiceName)
.filter(Objects::nonNull).distinct().collect(Collectors.toList());
List<String> localServiceNames = spans.stream().map(Span::localServiceName).filter(Objects::nonNull).distinct()
.collect(Collectors.toList());
List<String> remoteServiceNames = spans.stream().map(Span::remoteServiceName).filter(Objects::nonNull)
.distinct().collect(Collectors.toList());
List<String> names = new ArrayList<>();
names.addAll(localServiceNames);
names.addAll(remoteServiceNames);
@@ -142,11 +133,9 @@ public class ZipkinTests extends AbstractIntegrationTest {
List<String> hasRequiredTag(List<Span> spans) {
String key = getRequiredTagKey();
Optional<String> keys = spans.stream()
.flatMap(span -> span.tags().keySet().stream()).filter(key::equals)
Optional<String> keys = spans.stream().flatMap(span -> span.tags().keySet().stream()).filter(key::equals)
.findFirst();
return keys.isPresent() ? Collections.emptyList()
: Collections.singletonList(key);
return keys.isPresent() ? Collections.emptyList() : Collections.singletonList(key);
}
String getRequiredTagKey() {