diff --git a/pom.xml b/pom.xml index 158583bc3..d6df8f7ff 100644 --- a/pom.xml +++ b/pom.xml @@ -256,6 +256,11 @@ 2.1.7.RELEASE false + + 3.10.0 + 3.10.0 + 20.0 + 1.7.1 diff --git a/spring-cloud-sleuth-core/pom.xml b/spring-cloud-sleuth-core/pom.xml index 5e9a16c80..c468ba227 100644 --- a/spring-cloud-sleuth-core/pom.xml +++ b/spring-cloud-sleuth-core/pom.xml @@ -153,6 +153,11 @@ feign-core true + + io.github.openfeign.form + feign-form-spring + true + com.netflix.zuul zuul-core @@ -172,6 +177,7 @@ com.squareup.okhttp3 okhttp + ${okhttp.version} true @@ -307,7 +313,7 @@ com.squareup.okhttp3 mockwebserver - 3.5.0 + ${mockwebserver.version} test diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.java index 336470d2b..64b98979e 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.java @@ -42,7 +42,7 @@ import org.springframework.lang.Nullable; * @since 2.0.0 */ @Configuration -@ConditionalOnBean(Tracing.class) +@ConditionalOnBean(TraceWebAutoConfiguration.class) @ConditionalOnProperty(name = "spring.sleuth.http.enabled", havingValue = "true", matchIfMissing = true) @AutoConfigureAfter(TraceWebAutoConfiguration.class) diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebClientDisabledTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebClientDisabledTests.java new file mode 100644 index 000000000..f9443f3f8 --- /dev/null +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebClientDisabledTests.java @@ -0,0 +1,46 @@ +/* + * Copyright 2013-2019 the original author or 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 + * + * https://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 org.springframework.cloud.sleuth.instrument.web; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Configuration; +import org.springframework.test.context.junit4.SpringRunner; + +/** + * @author Marcin Grzejszczak + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = { TraceWebClientDisabledTests.Config.class }, properties = { + "spring.sleuth.web.enabled=true", "spring.sleuth.web.client.enabled=false" }) +public class TraceWebClientDisabledTests { + + @Test + public void should_load_context() { + + } + + @Configuration + @EnableAutoConfiguration + public static class Config { + + } + +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/integration/WebClientTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/integration/WebClientTests.java index 4ed89e513..9f615b8cf 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/integration/WebClientTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/integration/WebClientTests.java @@ -16,7 +16,6 @@ package org.springframework.cloud.sleuth.instrument.web.client.integration; -import java.time.Duration; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -53,7 +52,6 @@ import org.awaitility.Awaitility; import org.junit.After; import org.junit.Before; import org.junit.ClassRule; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -394,32 +392,6 @@ public class WebClientTests { then(this.tracer.currentSpan()).isNull(); } - @Test - @Ignore("Flakey on CI") - public void shouldReportTraceForCancelledRequestViaWebClient() { - Span span = this.tracer.nextSpan().name("foo").start(); - - try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span)) { - this.webClient.get().uri("http://localhost:" + this.port + "/noresponse") - .retrieve().bodyToMono(String.class).timeout(Duration.ofMillis(0)) - .block(); - } - catch (Exception e) { - - } - finally { - span.finish(); - } - - Awaitility.await().untilAsserted(() -> { - System.out.println("Found spans " + this.reporter.getSpans()); - final Optional clientSpan = this.reporter.getSpans().stream() - .filter(s -> s.kind() == zipkin2.Span.Kind.CLIENT).findFirst(); - then(clientSpan).isPresent(); - then(clientSpan.get().tags()).containsEntry("error", "CANCELLED"); - }); - } - Object[] parametersForShouldAttachTraceIdWhenCallingAnotherService() { return new Object[] { (ResponseEntityProvider) (tests) -> tests.testFeignInterface.headers(), diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/pom.xml b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/pom.xml index ab2b188c8..7d1892f83 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/pom.xml +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/pom.xml @@ -86,6 +86,11 @@ org.springframework.boot spring-boot-starter-actuator + + io.github.openfeign.form + feign-form-spring + true + org.springframework.boot spring-boot-starter-test diff --git a/tests/spring-cloud-sleuth-instrumentation-mvc-tests/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebDisabledTests.java b/tests/spring-cloud-sleuth-instrumentation-mvc-tests/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebDisabledTests.java index 5063aba66..5ce258718 100644 --- a/tests/spring-cloud-sleuth-instrumentation-mvc-tests/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebDisabledTests.java +++ b/tests/spring-cloud-sleuth-instrumentation-mvc-tests/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebDisabledTests.java @@ -28,8 +28,8 @@ import org.springframework.test.context.junit4.SpringRunner; * @author Marcin Grzejszczak */ @RunWith(SpringRunner.class) -@SpringBootTest(classes = { TraceWebDisabledTests.Config.class }, properties = { - "spring.sleuth.web.enabled=true", "spring.sleuth.web.client.enabled=false" }) +@SpringBootTest(classes = { TraceWebDisabledTests.Config.class }, + properties = { "spring.sleuth.web.enabled=false" }) public class TraceWebDisabledTests { @Test