Fixed the build

This commit is contained in:
Marcin Grzejszczak
2019-02-07 12:51:36 +01:00
parent 93d6578819
commit 3107d3f380
15 changed files with 111 additions and 120 deletions

View File

@@ -25,7 +25,7 @@ package org.springframework.cloud.sleuth.annotation;
class NoOpTagValueResolver implements TagValueResolver { class NoOpTagValueResolver implements TagValueResolver {
@Override @Override
public String resolve(Object parameter) { public String resolve() {
return null; return null;
} }

View File

@@ -151,7 +151,7 @@ class SpanTagAnnotationHandler {
if (annotation.resolver() != NoOpTagValueResolver.class) { if (annotation.resolver() != NoOpTagValueResolver.class) {
TagValueResolver tagValueResolver = this.beanFactory TagValueResolver tagValueResolver = this.beanFactory
.getBean(annotation.resolver()); .getBean(annotation.resolver());
return tagValueResolver.resolve(argument); return tagValueResolver.resolve();
} }
else if (StringUtils.hasText(annotation.expression())) { else if (StringUtils.hasText(annotation.expression())) {
return this.beanFactory.getBean(TagValueExpressionResolver.class) return this.beanFactory.getBean(TagValueExpressionResolver.class)

View File

@@ -26,9 +26,8 @@ public interface TagValueResolver {
/** /**
* Returns the tag value for the given parameter. * Returns the tag value for the given parameter.
* @param parameter - parameter annotated with {@link SpanTag}
* @return the value of the tag * @return the value of the tag
*/ */
String resolve(Object parameter); String resolve();
} }

View File

@@ -141,7 +141,7 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
headers.setImmutable(); headers.setImmutable();
Span result = this.tracer.nextSpan(extracted); Span result = this.tracer.nextSpan(extracted);
if (extracted.context() == null && !result.isNoop()) { if (extracted.context() == null && !result.isNoop()) {
addTags(message, result, null); addTags(result, null);
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Created a new span " + result); log.debug("Created a new span " + result);
@@ -167,7 +167,7 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
if (!span.isNoop()) { if (!span.isNoop()) {
span.kind(Span.Kind.PRODUCER).name("send").start(); span.kind(Span.Kind.PRODUCER).name("send").start();
span.remoteServiceName(REMOTE_SERVICE_NAME); span.remoteServiceName(REMOTE_SERVICE_NAME);
addTags(message, span, channel); addTags(span, channel);
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Created a new span in pre send" + span); log.debug("Created a new span in pre send" + span);
@@ -253,7 +253,7 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
if (!span.isNoop()) { if (!span.isNoop()) {
span.kind(Span.Kind.CONSUMER).name("receive").start(); span.kind(Span.Kind.CONSUMER).name("receive").start();
span.remoteServiceName(REMOTE_SERVICE_NAME); span.remoteServiceName(REMOTE_SERVICE_NAME);
addTags(message, span, channel); addTags(span, channel);
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Created a new span in post receive " + span); log.debug("Created a new span in post receive " + span);
@@ -292,7 +292,7 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
if (!consumerSpan.isNoop()) { if (!consumerSpan.isNoop()) {
consumerSpan.kind(Span.Kind.CONSUMER).start(); consumerSpan.kind(Span.Kind.CONSUMER).start();
consumerSpan.remoteServiceName(REMOTE_SERVICE_NAME); consumerSpan.remoteServiceName(REMOTE_SERVICE_NAME);
addTags(message, consumerSpan, channel); addTags(consumerSpan, channel);
consumerSpan.finish(); consumerSpan.finish();
} }
// create and scope a span for the message processor // create and scope a span for the message processor
@@ -331,7 +331,7 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
/** /**
* When an upstream context was not present, lookup keys are unlikely added * When an upstream context was not present, lookup keys are unlikely added
*/ */
void addTags(Message<?> message, SpanCustomizer result, MessageChannel channel) { void addTags(SpanCustomizer result, MessageChannel channel) {
// TODO topic etc // TODO topic etc
if (channel != null) { if (channel != null) {
result.tag("channel", messageChannelName(channel)); result.tag("channel", messageChannelName(channel));

View File

@@ -106,8 +106,6 @@ class HttpClientBeanPostProcessor implements BeanPostProcessor {
HttpTracing httpTracing; HttpTracing httpTracing;
Tracer tracer;
HttpClientHandler<HttpClientRequest, HttpClientResponse> handler; HttpClientHandler<HttpClientRequest, HttpClientResponse> handler;
TraceContext.Injector<HttpHeaders> injector; TraceContext.Injector<HttpHeaders> injector;

View File

@@ -27,7 +27,7 @@ public class NoOpTagValueResolverTests {
@Test @Test
public void should_return_null() throws Exception { public void should_return_null() throws Exception {
then(new NoOpTagValueResolver().resolve("")).isNull(); then(new NoOpTagValueResolver().resolve()).isNull();
} }
} }

View File

@@ -131,7 +131,7 @@ public class SleuthSpanCreatorAspectFluxTests {
@Test @Test
public void shouldCreateSpanWithTagWhenAnnotationOnInterfaceMethod() { public void shouldCreateSpanWithTagWhenAnnotationOnInterfaceMethod() {
// tag::execution[] // tag::execution[]
Flux<String> flux = this.testBean.testMethod5("test"); Flux<String> flux = this.testBean.testMethod5();
// end::execution[] // end::execution[]
verifyNoSpansUntilFluxComplete(flux); verifyNoSpansUntilFluxComplete(flux);
@@ -148,7 +148,7 @@ public class SleuthSpanCreatorAspectFluxTests {
@Test @Test
public void shouldCreateSpanWithTagWhenAnnotationOnClassMethod() { public void shouldCreateSpanWithTagWhenAnnotationOnClassMethod() {
Flux<String> flux = this.testBean.testMethod6("test"); Flux<String> flux = this.testBean.testMethod6();
verifyNoSpansUntilFluxComplete(flux); verifyNoSpansUntilFluxComplete(flux);
@@ -164,7 +164,7 @@ public class SleuthSpanCreatorAspectFluxTests {
@Test @Test
public void shouldCreateSpanWithLogWhenAnnotationOnInterfaceMethod() { public void shouldCreateSpanWithLogWhenAnnotationOnInterfaceMethod() {
Flux<String> flux = this.testBean.testMethod8("test"); Flux<String> flux = this.testBean.testMethod8();
verifyNoSpansUntilFluxComplete(flux); verifyNoSpansUntilFluxComplete(flux);
@@ -179,7 +179,7 @@ public class SleuthSpanCreatorAspectFluxTests {
@Test @Test
public void shouldCreateSpanWithLogWhenAnnotationOnClassMethod() { public void shouldCreateSpanWithLogWhenAnnotationOnClassMethod() {
Flux<String> flux = this.testBean.testMethod9("test"); Flux<String> flux = this.testBean.testMethod9();
verifyNoSpansUntilFluxComplete(flux); verifyNoSpansUntilFluxComplete(flux);
@@ -199,7 +199,7 @@ public class SleuthSpanCreatorAspectFluxTests {
Span span = this.tracer.nextSpan().name("foo"); Span span = this.tracer.nextSpan().name("foo");
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) { try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
Flux<String> flux = this.testBean.testMethod10("test"); Flux<String> flux = this.testBean.testMethod10();
verifyNoSpansUntilFluxComplete(flux); verifyNoSpansUntilFluxComplete(flux);
} }
@@ -222,7 +222,7 @@ public class SleuthSpanCreatorAspectFluxTests {
@Test @Test
public void shouldStartAndCloseSpanOnContinueSpanIfSpanNotSet() { public void shouldStartAndCloseSpanOnContinueSpanIfSpanNotSet() {
Flux<String> flux = this.testBean.testMethod10("test"); Flux<String> flux = this.testBean.testMethod10();
verifyNoSpansUntilFluxComplete(flux); verifyNoSpansUntilFluxComplete(flux);
Awaitility.await().untilAsserted(() -> { Awaitility.await().untilAsserted(() -> {
@@ -243,7 +243,7 @@ public class SleuthSpanCreatorAspectFluxTests {
Span span = this.tracer.nextSpan().name("foo"); Span span = this.tracer.nextSpan().name("foo");
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) { try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
Flux<String> flux = this.testBean.testMethod10_v2("test"); Flux<String> flux = this.testBean.testMethod10_v2();
verifyNoSpansUntilFluxComplete(flux); verifyNoSpansUntilFluxComplete(flux);
} }
@@ -270,7 +270,7 @@ public class SleuthSpanCreatorAspectFluxTests {
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) { try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
// tag::continue_span_execution[] // tag::continue_span_execution[]
Flux<String> flux = this.testBean.testMethod11("test"); Flux<String> flux = this.testBean.testMethod11();
// end::continue_span_execution[] // end::continue_span_execution[]
verifyNoSpansUntilFluxComplete(flux); verifyNoSpansUntilFluxComplete(flux);
} }
@@ -296,7 +296,7 @@ public class SleuthSpanCreatorAspectFluxTests {
@Test @Test
public void shouldAddErrorTagWhenExceptionOccurredInNewSpan() { public void shouldAddErrorTagWhenExceptionOccurredInNewSpan() {
try { try {
Flux<String> flux = this.testBean.testMethod12("test"); Flux<String> flux = this.testBean.testMethod12();
then(this.reporter.getSpans()).isEmpty(); then(this.reporter.getSpans()).isEmpty();
@@ -428,38 +428,38 @@ public class SleuthSpanCreatorAspectFluxTests {
// tag::custom_name_and_tag_on_annotated_method[] // tag::custom_name_and_tag_on_annotated_method[]
@NewSpan(name = "customNameOnTestMethod5") @NewSpan(name = "customNameOnTestMethod5")
Flux<String> testMethod5(@SpanTag("testTag") String param); Flux<String> testMethod5();
// end::custom_name_and_tag_on_annotated_method[] // end::custom_name_and_tag_on_annotated_method[]
Flux<String> testMethod6(String test); Flux<String> testMethod6();
Flux<String> testMethod7(); Flux<String> testMethod7();
@NewSpan(name = "customNameOnTestMethod8") @NewSpan(name = "customNameOnTestMethod8")
Flux<String> testMethod8(String param); Flux<String> testMethod8();
@NewSpan(name = "testMethod9") @NewSpan(name = "testMethod9")
Flux<String> testMethod9(String param); Flux<String> testMethod9();
@ContinueSpan(log = "customTest") @ContinueSpan(log = "customTest")
Flux<String> testMethod10(@SpanTag(value = "testTag10") String param); Flux<String> testMethod10();
@ContinueSpan(log = "customTest") @ContinueSpan(log = "customTest")
Flux<String> testMethod10_v2(@SpanTag(key = "testTag10") String param); Flux<String> testMethod10_v2();
// tag::continue_span[] // tag::continue_span[]
@ContinueSpan(log = "testMethod11") @ContinueSpan(log = "testMethod11")
Flux<String> testMethod11(@SpanTag("testTag11") String param); Flux<String> testMethod11();
// end::continue_span[] // end::continue_span[]
@NewSpan @NewSpan
Flux<String> testMethod12(@SpanTag("testTag12") String param); Flux<String> testMethod12();
@ContinueSpan(log = "testMethod13") @ContinueSpan(log = "testMethod13")
Flux<String> testMethod13(); Flux<String> testMethod13();
@ContinueSpan @ContinueSpan
Flux<String> testMethod14(String param); Flux<String> testMethod14();
@NewSpan(name = "spanInTraceContext") @NewSpan(name = "spanInTraceContext")
Flux<Long> newSpanInTraceContext(); Flux<Long> newSpanInTraceContext();
@@ -527,13 +527,13 @@ public class SleuthSpanCreatorAspectFluxTests {
} }
@Override @Override
public Flux<String> testMethod5(String test) { public Flux<String> testMethod5() {
return this.testFlux; return this.testFlux;
} }
@NewSpan(name = "customNameOnTestMethod6") @NewSpan(name = "customNameOnTestMethod6")
@Override @Override
public Flux<String> testMethod6(@SpanTag("testTag6") String test) { public Flux<String> testMethod6() {
return this.testFlux; return this.testFlux;
} }
@@ -543,36 +543,34 @@ public class SleuthSpanCreatorAspectFluxTests {
} }
@Override @Override
public Flux<String> testMethod8(String param) { public Flux<String> testMethod8() {
return this.testFlux; return this.testFlux;
} }
@NewSpan(name = "customNameOnTestMethod9") @NewSpan(name = "customNameOnTestMethod9")
@Override @Override
public Flux<String> testMethod9(String param) { public Flux<String> testMethod9() {
return this.testFlux; return this.testFlux;
} }
@Override @Override
public Flux<String> testMethod10( public Flux<String> testMethod10() {
@SpanTag(value = "customTestTag10") String param) {
return this.testFlux; return this.testFlux;
} }
@Override @Override
public Flux<String> testMethod10_v2( public Flux<String> testMethod10_v2() {
@SpanTag(key = "customTestTag10") String param) {
return this.testFlux; return this.testFlux;
} }
@ContinueSpan(log = "customTest") @ContinueSpan(log = "customTest")
@Override @Override
public Flux<String> testMethod11(@SpanTag("customTestTag11") String param) { public Flux<String> testMethod11() {
return this.testFlux; return this.testFlux;
} }
@Override @Override
public Flux<String> testMethod12(String param) { public Flux<String> testMethod12() {
return Flux return Flux
.defer(() -> Flux.error(new RuntimeException("test exception 12"))); .defer(() -> Flux.error(new RuntimeException("test exception 12")));
} }
@@ -584,7 +582,7 @@ public class SleuthSpanCreatorAspectFluxTests {
} }
@Override @Override
public Flux<String> testMethod14(String param) { public Flux<String> testMethod14() {
return Flux.just(TEST_STRING1, TEST_STRING2); return Flux.just(TEST_STRING1, TEST_STRING2);
} }

View File

@@ -44,11 +44,12 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.BDDAssertions.then; import static org.assertj.core.api.BDDAssertions.then;
import static org.springframework.cloud.sleuth.annotation.SleuthSpanCreatorAspectMonoTests.TestBean.TEST_STRING; import static org.springframework.cloud.sleuth.annotation.SleuthSpanCreatorAspectMonoTests.TestBean.TEST_STRING;
import static org.springframework.test.annotation.DirtiesContext.MethodMode.BEFORE_METHOD;
import static reactor.core.publisher.Mono.just; import static reactor.core.publisher.Mono.just;
@SpringBootTest(classes = SleuthSpanCreatorAspectMonoTests.TestConfiguration.class) @SpringBootTest(classes = SleuthSpanCreatorAspectMonoTests.TestConfiguration.class)
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@DirtiesContext @DirtiesContext(methodMode = BEFORE_METHOD)
public class SleuthSpanCreatorAspectMonoTests { public class SleuthSpanCreatorAspectMonoTests {
@Autowired @Autowired
@@ -140,7 +141,7 @@ public class SleuthSpanCreatorAspectMonoTests {
@Test @Test
public void shouldCreateSpanWithTagWhenAnnotationOnInterfaceMethod() { public void shouldCreateSpanWithTagWhenAnnotationOnInterfaceMethod() {
// tag::execution[] // tag::execution[]
Mono<String> mono = this.testBean.testMethod5("test"); Mono<String> mono = this.testBean.testMethod5();
// end::execution[] // end::execution[]
then(this.reporter.getSpans()).isEmpty(); then(this.reporter.getSpans()).isEmpty();
@@ -159,7 +160,7 @@ public class SleuthSpanCreatorAspectMonoTests {
@Test @Test
public void shouldCreateSpanWithTagWhenAnnotationOnClassMethod() { public void shouldCreateSpanWithTagWhenAnnotationOnClassMethod() {
Mono<String> mono = this.testBean.testMethod6("test"); Mono<String> mono = this.testBean.testMethod6();
then(this.reporter.getSpans()).isEmpty(); then(this.reporter.getSpans()).isEmpty();
@@ -177,7 +178,7 @@ public class SleuthSpanCreatorAspectMonoTests {
@Test @Test
public void shouldCreateSpanWithLogWhenAnnotationOnInterfaceMethod() { public void shouldCreateSpanWithLogWhenAnnotationOnInterfaceMethod() {
Mono<String> mono = this.testBean.testMethod8("test"); Mono<String> mono = this.testBean.testMethod8();
then(this.reporter.getSpans()).isEmpty(); then(this.reporter.getSpans()).isEmpty();
@@ -194,7 +195,7 @@ public class SleuthSpanCreatorAspectMonoTests {
@Test @Test
public void shouldCreateSpanWithLogWhenAnnotationOnClassMethod() { public void shouldCreateSpanWithLogWhenAnnotationOnClassMethod() {
Mono<String> mono = this.testBean.testMethod9("test"); Mono<String> mono = this.testBean.testMethod9();
then(this.reporter.getSpans()).isEmpty(); then(this.reporter.getSpans()).isEmpty();
@@ -216,7 +217,7 @@ public class SleuthSpanCreatorAspectMonoTests {
Span span = this.tracer.nextSpan().name("foo"); Span span = this.tracer.nextSpan().name("foo");
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) { try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
Mono<String> mono = this.testBean.testMethod10("test"); Mono<String> mono = this.testBean.testMethod10();
then(this.reporter.getSpans()).isEmpty(); then(this.reporter.getSpans()).isEmpty();
@@ -241,7 +242,7 @@ public class SleuthSpanCreatorAspectMonoTests {
@Test @Test
public void shouldStartAndCloseSpanOnContinueSpanIfSpanNotSet() { public void shouldStartAndCloseSpanOnContinueSpanIfSpanNotSet() {
this.testBean.testMethod10("test").block(); this.testBean.testMethod10().block();
Awaitility.await().untilAsserted(() -> { Awaitility.await().untilAsserted(() -> {
List<zipkin2.Span> spans = this.reporter.getSpans(); List<zipkin2.Span> spans = this.reporter.getSpans();
@@ -261,7 +262,7 @@ public class SleuthSpanCreatorAspectMonoTests {
Span span = this.tracer.nextSpan().name("foo"); Span span = this.tracer.nextSpan().name("foo");
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) { try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
Mono<String> mono = this.testBean.testMethod10_v2("test"); Mono<String> mono = this.testBean.testMethod10_v2();
then(this.reporter.getSpans()).isEmpty(); then(this.reporter.getSpans()).isEmpty();
@@ -290,7 +291,7 @@ public class SleuthSpanCreatorAspectMonoTests {
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) { try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
// tag::continue_span_execution[] // tag::continue_span_execution[]
Mono<String> mono = this.testBean.testMethod11("test"); Mono<String> mono = this.testBean.testMethod11();
// end::continue_span_execution[] // end::continue_span_execution[]
then(this.reporter.getSpans()).isEmpty(); then(this.reporter.getSpans()).isEmpty();
@@ -318,7 +319,7 @@ public class SleuthSpanCreatorAspectMonoTests {
@Test @Test
public void shouldAddErrorTagWhenExceptionOccurredInNewSpan() { public void shouldAddErrorTagWhenExceptionOccurredInNewSpan() {
try { try {
Mono<String> mono = this.testBean.testMethod12("test"); Mono<String> mono = this.testBean.testMethod12();
then(this.reporter.getSpans()).isEmpty(); then(this.reporter.getSpans()).isEmpty();
@@ -489,32 +490,32 @@ public class SleuthSpanCreatorAspectMonoTests {
// tag::custom_name_and_tag_on_annotated_method[] // tag::custom_name_and_tag_on_annotated_method[]
@NewSpan(name = "customNameOnTestMethod5") @NewSpan(name = "customNameOnTestMethod5")
Mono<String> testMethod5(@SpanTag("testTag") String param); Mono<String> testMethod5();
// end::custom_name_and_tag_on_annotated_method[] // end::custom_name_and_tag_on_annotated_method[]
Mono<String> testMethod6(String test); Mono<String> testMethod6();
Mono<String> testMethod7(); Mono<String> testMethod7();
@NewSpan(name = "customNameOnTestMethod8") @NewSpan(name = "customNameOnTestMethod8")
Mono<String> testMethod8(String param); Mono<String> testMethod8();
@NewSpan(name = "testMethod9") @NewSpan(name = "testMethod9")
Mono<String> testMethod9(String param); Mono<String> testMethod9();
@ContinueSpan(log = "customTest") @ContinueSpan(log = "customTest")
Mono<String> testMethod10(@SpanTag(value = "testTag10") String param); Mono<String> testMethod10();
@ContinueSpan(log = "customTest") @ContinueSpan(log = "customTest")
Mono<String> testMethod10_v2(@SpanTag(key = "testTag10") String param); Mono<String> testMethod10_v2();
// tag::continue_span[] // tag::continue_span[]
@ContinueSpan(log = "testMethod11") @ContinueSpan(log = "testMethod11")
Mono<String> testMethod11(@SpanTag("testTag11") String param); Mono<String> testMethod11();
// end::continue_span[] // end::continue_span[]
@NewSpan @NewSpan
Mono<String> testMethod12(@SpanTag("testTag12") String param); Mono<String> testMethod12();
@ContinueSpan(log = "testMethod13") @ContinueSpan(log = "testMethod13")
Mono<String> testMethod13(); Mono<String> testMethod13();
@@ -564,13 +565,13 @@ public class SleuthSpanCreatorAspectMonoTests {
} }
@Override @Override
public Mono<String> testMethod5(String test) { public Mono<String> testMethod5() {
return TEST_MONO; return TEST_MONO;
} }
@NewSpan(name = "customNameOnTestMethod6") @NewSpan(name = "customNameOnTestMethod6")
@Override @Override
public Mono<String> testMethod6(@SpanTag("testTag6") String test) { public Mono<String> testMethod6() {
return TEST_MONO; return TEST_MONO;
} }
@@ -580,36 +581,34 @@ public class SleuthSpanCreatorAspectMonoTests {
} }
@Override @Override
public Mono<String> testMethod8(String param) { public Mono<String> testMethod8() {
return TEST_MONO; return TEST_MONO;
} }
@NewSpan(name = "customNameOnTestMethod9") @NewSpan(name = "customNameOnTestMethod9")
@Override @Override
public Mono<String> testMethod9(String param) { public Mono<String> testMethod9() {
return TEST_MONO; return TEST_MONO;
} }
@Override @Override
public Mono<String> testMethod10( public Mono<String> testMethod10() {
@SpanTag(value = "customTestTag10") String param) {
return TEST_MONO; return TEST_MONO;
} }
@Override @Override
public Mono<String> testMethod10_v2( public Mono<String> testMethod10_v2() {
@SpanTag(key = "customTestTag10") String param) {
return TEST_MONO; return TEST_MONO;
} }
@ContinueSpan(log = "customTest") @ContinueSpan(log = "customTest")
@Override @Override
public Mono<String> testMethod11(@SpanTag("customTestTag11") String param) { public Mono<String> testMethod11() {
return TEST_MONO; return TEST_MONO;
} }
@Override @Override
public Mono<String> testMethod12(String param) { public Mono<String> testMethod12() {
return Mono return Mono
.defer(() -> Mono.error(new RuntimeException("test exception 12"))); .defer(() -> Mono.error(new RuntimeException("test exception 12")));
} }

View File

@@ -95,9 +95,9 @@ public class SleuthSpanCreatorAspectNegativeTests {
void testMethod4(); void testMethod4();
@NewSpan(name = "testMethod5") @NewSpan(name = "testMethod5")
void testMethod5(@SpanTag("testTag") String test); void testMethod5();
void testMethod6(String test); void testMethod6();
void testMethod7(); void testMethod7();
@@ -124,12 +124,12 @@ public class SleuthSpanCreatorAspectNegativeTests {
} }
@Override @Override
public void testMethod5(String test) { public void testMethod5() {
} }
@NewSpan(name = "testMethod6") @NewSpan(name = "testMethod6")
@Override @Override
public void testMethod6(@SpanTag("testTag6") String test) { public void testMethod6() {
} }

View File

@@ -102,7 +102,7 @@ public class SleuthSpanCreatorAspectTests {
@Test @Test
public void shouldCreateSpanWithTagWhenAnnotationOnInterfaceMethod() { public void shouldCreateSpanWithTagWhenAnnotationOnInterfaceMethod() {
// tag::execution[] // tag::execution[]
this.testBean.testMethod5("test"); this.testBean.testMethod5();
// end::execution[] // end::execution[]
List<zipkin2.Span> spans = this.reporter.getSpans(); List<zipkin2.Span> spans = this.reporter.getSpans();
@@ -115,7 +115,7 @@ public class SleuthSpanCreatorAspectTests {
@Test @Test
public void shouldCreateSpanWithTagWhenAnnotationOnClassMethod() { public void shouldCreateSpanWithTagWhenAnnotationOnClassMethod() {
this.testBean.testMethod6("test"); this.testBean.testMethod6();
List<zipkin2.Span> spans = this.reporter.getSpans(); List<zipkin2.Span> spans = this.reporter.getSpans();
then(spans).hasSize(1); then(spans).hasSize(1);
@@ -127,7 +127,7 @@ public class SleuthSpanCreatorAspectTests {
@Test @Test
public void shouldCreateSpanWithLogWhenAnnotationOnInterfaceMethod() { public void shouldCreateSpanWithLogWhenAnnotationOnInterfaceMethod() {
this.testBean.testMethod8("test"); this.testBean.testMethod8();
List<zipkin2.Span> spans = this.reporter.getSpans(); List<zipkin2.Span> spans = this.reporter.getSpans();
then(spans).hasSize(1); then(spans).hasSize(1);
@@ -138,7 +138,7 @@ public class SleuthSpanCreatorAspectTests {
@Test @Test
public void shouldCreateSpanWithLogWhenAnnotationOnClassMethod() { public void shouldCreateSpanWithLogWhenAnnotationOnClassMethod() {
this.testBean.testMethod9("test"); this.testBean.testMethod9();
List<zipkin2.Span> spans = this.reporter.getSpans(); List<zipkin2.Span> spans = this.reporter.getSpans();
then(spans).hasSize(1); then(spans).hasSize(1);
@@ -154,7 +154,7 @@ public class SleuthSpanCreatorAspectTests {
Span span = this.tracer.nextSpan().name("foo"); Span span = this.tracer.nextSpan().name("foo");
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) { try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
this.testBean.testMethod10("test"); this.testBean.testMethod10();
} }
finally { finally {
span.finish(); span.finish();
@@ -173,7 +173,7 @@ public class SleuthSpanCreatorAspectTests {
@Test @Test
public void shouldStartAndCloseSpanOnContinueSpanIfSpanNotSet() { public void shouldStartAndCloseSpanOnContinueSpanIfSpanNotSet() {
this.testBean.testMethod10("test"); this.testBean.testMethod10();
List<zipkin2.Span> spans = this.reporter.getSpans(); List<zipkin2.Span> spans = this.reporter.getSpans();
then(spans).hasSize(1); then(spans).hasSize(1);
@@ -191,7 +191,7 @@ public class SleuthSpanCreatorAspectTests {
Span span = this.tracer.nextSpan().name("foo"); Span span = this.tracer.nextSpan().name("foo");
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) { try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
this.testBean.testMethod10_v2("test"); this.testBean.testMethod10_v2();
} }
finally { finally {
span.finish(); span.finish();
@@ -214,7 +214,7 @@ public class SleuthSpanCreatorAspectTests {
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) { try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
// tag::continue_span_execution[] // tag::continue_span_execution[]
this.testBean.testMethod11("test"); this.testBean.testMethod11();
// end::continue_span_execution[] // end::continue_span_execution[]
} }
finally { finally {
@@ -237,7 +237,7 @@ public class SleuthSpanCreatorAspectTests {
@Test @Test
public void shouldAddErrorTagWhenExceptionOccurredInNewSpan() { public void shouldAddErrorTagWhenExceptionOccurredInNewSpan() {
try { try {
this.testBean.testMethod12("test"); this.testBean.testMethod12();
} }
catch (RuntimeException ignored) { catch (RuntimeException ignored) {
} }
@@ -305,32 +305,32 @@ public class SleuthSpanCreatorAspectTests {
// tag::custom_name_and_tag_on_annotated_method[] // tag::custom_name_and_tag_on_annotated_method[]
@NewSpan(name = "customNameOnTestMethod5") @NewSpan(name = "customNameOnTestMethod5")
void testMethod5(@SpanTag("testTag") String param); void testMethod5();
// end::custom_name_and_tag_on_annotated_method[] // end::custom_name_and_tag_on_annotated_method[]
void testMethod6(String test); void testMethod6();
void testMethod7(); void testMethod7();
@NewSpan(name = "customNameOnTestMethod8") @NewSpan(name = "customNameOnTestMethod8")
void testMethod8(String param); void testMethod8();
@NewSpan(name = "testMethod9") @NewSpan(name = "testMethod9")
void testMethod9(String param); void testMethod9();
@ContinueSpan(log = "customTest") @ContinueSpan(log = "customTest")
void testMethod10(@SpanTag(value = "testTag10") String param); void testMethod10();
@ContinueSpan(log = "customTest") @ContinueSpan(log = "customTest")
void testMethod10_v2(@SpanTag(key = "testTag10") String param); void testMethod10_v2();
// tag::continue_span[] // tag::continue_span[]
@ContinueSpan(log = "testMethod11") @ContinueSpan(log = "testMethod11")
void testMethod11(@SpanTag("testTag11") String param); void testMethod11();
// end::continue_span[] // end::continue_span[]
@NewSpan @NewSpan
void testMethod12(@SpanTag("testTag12") String param); void testMethod12();
@ContinueSpan(log = "testMethod13") @ContinueSpan(log = "testMethod13")
void testMethod13(); void testMethod13();
@@ -360,12 +360,12 @@ public class SleuthSpanCreatorAspectTests {
} }
@Override @Override
public void testMethod5(String test) { public void testMethod5() {
} }
@NewSpan(name = "customNameOnTestMethod6") @NewSpan(name = "customNameOnTestMethod6")
@Override @Override
public void testMethod6(@SpanTag("testTag6") String test) { public void testMethod6() {
} }
@@ -374,34 +374,34 @@ public class SleuthSpanCreatorAspectTests {
} }
@Override @Override
public void testMethod8(String param) { public void testMethod8() {
} }
@NewSpan(name = "customNameOnTestMethod9") @NewSpan(name = "customNameOnTestMethod9")
@Override @Override
public void testMethod9(String param) { public void testMethod9() {
} }
@Override @Override
public void testMethod10(@SpanTag(value = "customTestTag10") String param) { public void testMethod10() {
} }
@Override @Override
public void testMethod10_v2(@SpanTag(key = "customTestTag10") String param) { public void testMethod10_v2() {
} }
@ContinueSpan(log = "customTest") @ContinueSpan(log = "customTest")
@Override @Override
public void testMethod11(@SpanTag("customTestTag11") String param) { public void testMethod11() {
} }
@Override @Override
public void testMethod12(String param) { public void testMethod12() {
throw new RuntimeException("test exception 12"); throw new RuntimeException("test exception 12");
} }

View File

@@ -103,21 +103,19 @@ public class SpanTagAnnotationHandlerTests {
// tag::resolver_bean[] // tag::resolver_bean[]
@NewSpan @NewSpan
public void getAnnotationForTagValueResolver( public void getAnnotationForTagValueResolver() {
@SpanTag(key = "test", resolver = TagValueResolver.class) String test) {
} }
// end::resolver_bean[] // end::resolver_bean[]
// tag::spel[] // tag::spel[]
@NewSpan @NewSpan
public void getAnnotationForTagValueExpression( public void getAnnotationForTagValueExpression() {
@SpanTag(key = "test", expression = "'hello' + ' characters'") String test) {
} }
// end::spel[] // end::spel[]
// tag::toString[] // tag::toString[]
@NewSpan @NewSpan
public void getAnnotationForArgumentToString(@SpanTag("test") Long param) { public void getAnnotationForArgumentToString() {
} }
// end::toString[] // end::toString[]
@@ -130,7 +128,7 @@ public class SpanTagAnnotationHandlerTests {
// tag::custom_resolver[] // tag::custom_resolver[]
@Bean(name = "myCustomTagValueResolver") @Bean(name = "myCustomTagValueResolver")
public TagValueResolver tagValueResolver() { public TagValueResolver tagValueResolver() {
return parameter -> "Value from myCustomTagValueResolver"; return () -> "Value from myCustomTagValueResolver";
} }
// end::custom_resolver[] // end::custom_resolver[]

View File

@@ -72,7 +72,7 @@ public class TraceableScheduledExecutorServiceTest {
then(this.scheduledExecutorService).should().schedule( then(this.scheduledExecutorService).should().schedule(
BDDMockito.argThat( BDDMockito.argThat(
matcher(Runnable.class, instanceOf(TraceRunnable.class))), matcher(instanceOf(TraceRunnable.class))),
anyLong(), any(TimeUnit.class)); anyLong(), any(TimeUnit.class));
} }
@@ -82,7 +82,7 @@ public class TraceableScheduledExecutorServiceTest {
then(this.scheduledExecutorService).should().schedule( then(this.scheduledExecutorService).should().schedule(
BDDMockito.argThat( BDDMockito.argThat(
matcher(Callable.class, instanceOf(TraceCallable.class))), matcher(instanceOf(TraceCallable.class))),
anyLong(), any(TimeUnit.class)); anyLong(), any(TimeUnit.class));
} }
@@ -93,7 +93,7 @@ public class TraceableScheduledExecutorServiceTest {
then(this.scheduledExecutorService).should().scheduleAtFixedRate( then(this.scheduledExecutorService).should().scheduleAtFixedRate(
BDDMockito.argThat( BDDMockito.argThat(
matcher(Runnable.class, instanceOf(TraceRunnable.class))), matcher(instanceOf(TraceRunnable.class))),
anyLong(), anyLong(), any(TimeUnit.class)); anyLong(), anyLong(), any(TimeUnit.class));
} }
@@ -104,7 +104,7 @@ public class TraceableScheduledExecutorServiceTest {
then(this.scheduledExecutorService).should().scheduleWithFixedDelay( then(this.scheduledExecutorService).should().scheduleWithFixedDelay(
BDDMockito.argThat( BDDMockito.argThat(
matcher(Runnable.class, instanceOf(TraceRunnable.class))), matcher(instanceOf(TraceRunnable.class))),
anyLong(), anyLong(), any(TimeUnit.class)); anyLong(), anyLong(), any(TimeUnit.class));
} }
@@ -116,7 +116,7 @@ public class TraceableScheduledExecutorServiceTest {
then(this.scheduledExecutorService).should(never()).schedule( then(this.scheduledExecutorService).should(never()).schedule(
BDDMockito.argThat( BDDMockito.argThat(
matcher(Runnable.class, instanceOf(TraceRunnable.class))), matcher(instanceOf(TraceRunnable.class))),
anyLong(), any(TimeUnit.class)); anyLong(), any(TimeUnit.class));
} }
@@ -128,7 +128,7 @@ public class TraceableScheduledExecutorServiceTest {
then(this.scheduledExecutorService).should(never()).schedule( then(this.scheduledExecutorService).should(never()).schedule(
BDDMockito.argThat( BDDMockito.argThat(
matcher(Callable.class, instanceOf(TraceCallable.class))), matcher(instanceOf(TraceCallable.class))),
anyLong(), any(TimeUnit.class)); anyLong(), any(TimeUnit.class));
} }
@@ -141,7 +141,7 @@ public class TraceableScheduledExecutorServiceTest {
then(this.scheduledExecutorService).should(never()).scheduleAtFixedRate( then(this.scheduledExecutorService).should(never()).scheduleAtFixedRate(
BDDMockito.argThat( BDDMockito.argThat(
matcher(Runnable.class, instanceOf(TraceRunnable.class))), matcher(instanceOf(TraceRunnable.class))),
anyLong(), anyLong(), any(TimeUnit.class)); anyLong(), anyLong(), any(TimeUnit.class));
} }
@@ -154,7 +154,7 @@ public class TraceableScheduledExecutorServiceTest {
then(this.scheduledExecutorService).should(never()).scheduleWithFixedDelay( then(this.scheduledExecutorService).should(never()).scheduleWithFixedDelay(
BDDMockito.argThat( BDDMockito.argThat(
matcher(Runnable.class, instanceOf(TraceRunnable.class))), matcher(instanceOf(TraceRunnable.class))),
anyLong(), anyLong(), any(TimeUnit.class)); anyLong(), anyLong(), any(TimeUnit.class));
} }
@@ -162,7 +162,7 @@ public class TraceableScheduledExecutorServiceTest {
return (argument) -> argument.getClass().isAssignableFrom(clazz); return (argument) -> argument.getClass().isAssignableFrom(clazz);
} }
<T> ArgumentMatcher<T> matcher(Class<T> clazz, Predicate predicate) { <T> ArgumentMatcher<T> matcher(Predicate predicate) {
return predicate::test; return predicate::test;
} }

View File

@@ -21,13 +21,12 @@ public final class HelloServiceOuterClass {
private HelloServiceOuterClass() { private HelloServiceOuterClass() {
} }
public static void registerAllExtensions( public static void registerAllExtensions() {
com.google.protobuf.ExtensionRegistryLite registry) {
} }
public static void registerAllExtensions( public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) { com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); registerAllExtensions();
} }
static final com.google.protobuf.Descriptors.Descriptor internal_static_sample_grpc_HelloRequest_descriptor; static final com.google.protobuf.Descriptors.Descriptor internal_static_sample_grpc_HelloRequest_descriptor;

View File

@@ -112,7 +112,7 @@ class ParticipantsBean {
return this.participantsClient.getParticipants(raceId); return this.participantsClient.getParticipants(raceId);
} }
public List<Object> defaultParticipants(String raceId) { public List<Object> defaultParticipants() {
return new ArrayList<>(); return new ArrayList<>();
} }

View File

@@ -114,7 +114,7 @@ class ZipkinRestTemplateSenderConfiguration {
ZipkinUrlExtractor zipkinUrlExtractor(final ZipkinLoadBalancer zipkinLoadBalancer) { ZipkinUrlExtractor zipkinUrlExtractor(final ZipkinLoadBalancer zipkinLoadBalancer) {
return new ZipkinUrlExtractor() { return new ZipkinUrlExtractor() {
@Override @Override
public URI zipkinUrl(ZipkinProperties zipkinProperties) { public URI zipkinUrl() {
return zipkinLoadBalancer.instance(); return zipkinLoadBalancer.instance();
} }
}; };
@@ -145,7 +145,7 @@ class ZipkinRestTemplateWrapper extends RestTemplate {
protected <T> T doExecute(URI originalUrl, HttpMethod method, protected <T> T doExecute(URI originalUrl, HttpMethod method,
RequestCallback requestCallback, ResponseExtractor<T> responseExtractor) RequestCallback requestCallback, ResponseExtractor<T> responseExtractor)
throws RestClientException { throws RestClientException {
URI uri = this.extractor.zipkinUrl(this.zipkinProperties); URI uri = this.extractor.zipkinUrl();
URI newUri = resolvedZipkinUri(originalUrl, uri); URI newUri = resolvedZipkinUri(originalUrl, uri);
return super.doExecute(newUri, method, requestCallback, responseExtractor); return super.doExecute(newUri, method, requestCallback, responseExtractor);
} }
@@ -175,7 +175,7 @@ class ZipkinRestTemplateWrapper extends RestTemplate {
*/ */
interface ZipkinUrlExtractor { interface ZipkinUrlExtractor {
URI zipkinUrl(ZipkinProperties zipkinProperties); URI zipkinUrl();
} }