[#146] Introduced SpanName

- Added aspect to provide better naming for @Async

fixes #146
This commit is contained in:
Marcin Grzejszczak
2016-02-09 15:25:36 +01:00
parent a0a79584f4
commit 1b0c8dfee5
54 changed files with 603 additions and 226 deletions

View File

@@ -16,18 +16,19 @@
package org.springframework.cloud.sleuth.stream;
import org.junit.Test;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.cloud.sleuth.Span;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collections;
import org.junit.Test;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.SpanName;
import static org.assertj.core.api.Assertions.assertThat;
public class ServerPropertiesHostLocatorTests {
Span span = new Span(1, 3, "name", 1L, Collections.<Long>emptyList(), 2L, true, true,
Span span = new Span(1, 3, new SpanName("http", "name"), 1L, Collections.<Long>emptyList(), 2L, true, true,
"process");
@Test

View File

@@ -35,6 +35,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.sleuth.Sampler;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.SpanName;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration;
import org.springframework.cloud.sleuth.event.ClientReceivedEvent;
@@ -75,16 +76,16 @@ public class StreamSpanListenerTests {
@Test
public void acquireAndRelease() {
Span context = this.tracer.startTrace("foo");
Span context = this.tracer.startTrace(new SpanName("http", "foo"));
this.tracer.close(context);
assertEquals(1, this.test.spans.size());
}
@Test
public void rpcAnnotations() {
Span parent = Span.builder().traceId(1L).name("parent").remote(true)
Span parent = Span.builder().traceId(1L).name(new SpanName("http", "parent")).remote(true)
.build();
Span context = this.tracer.joinTrace("child", parent);
Span context = this.tracer.joinTrace(new SpanName("http", "child"), parent);
this.application.publishEvent(new ClientSentEvent(this, context));
this.application
.publishEvent(new ServerReceivedEvent(this, parent, context));
@@ -107,7 +108,7 @@ public class StreamSpanListenerTests {
@Test
public void shouldIncreaseNumberOfAcceptedSpans() {
Span context = this.tracer.startTrace("foo");
Span context = this.tracer.startTrace(new SpanName("http", "foo"));
this.tracer.close(context);
this.listener.poll();