Search in sources :

Example 31 with Kind

use of zipkin2.Span.Kind in project zipkin by openzipkin.

the class SpanConverterTest method consumer.

@Test
public void consumer() {
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("next-message").kind(Kind.CONSUMER).localEndpoint(BACKEND).timestamp(1472470996199000L).build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("next-message").timestamp(1472470996199000L).addAnnotation(1472470996199000L, "mr", BACKEND).build();
    assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 32 with Kind

use of zipkin2.Span.Kind in project zipkin by openzipkin.

the class SpanConverterTest method redundantServiceNameOnAddressAnnotations_server.

/**
 * On server spans, ignore service name on remote address binary annotation that appear loopback
 * based on the service name. This could happen when finagle service labels are used incorrectly,
 * which as common in early instrumentation.
 *
 * <p>This prevents an uncorrectable scenario which results in extra (loopback) links on server
 * spans.
 */
@Test
public void redundantServiceNameOnAddressAnnotations_server() {
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").kind(Kind.SERVER).name("get").localEndpoint(FRONTEND).timestamp(1472470996199000L).duration(207000L).build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996199000L, "sr", FRONTEND).addAnnotation(1472470996406000L, "ss", FRONTEND).addBinaryAnnotation("ca", FRONTEND).addBinaryAnnotation("sa", FRONTEND).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 33 with Kind

use of zipkin2.Span.Kind in project zipkin by openzipkin.

the class V1SpanConverterTest method convert_sa_incorrect_value.

@Test
public void convert_sa_incorrect_value() {
    V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).addAnnotation(1472470996199000L, "cs", FRONTEND).addBinaryAnnotation("sa", "1", BACKEND).build();
    Span v2 = Span.newBuilder().traceId("1").id("2").kind(Kind.CLIENT).timestamp(1472470996199000L).localEndpoint(FRONTEND).remoteEndpoint(BACKEND).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 34 with Kind

use of zipkin2.Span.Kind in project zipkin by openzipkin.

the class V1SpanConverterTest method convert_ma.

@Test
public void convert_ma() {
    V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).addAnnotation(1472470996199000L, "mr", BACKEND).addBinaryAnnotation("ma", kafka).build();
    Span v2 = Span.newBuilder().traceId("1").id("2").kind(Kind.CONSUMER).timestamp(1472470996199000L).localEndpoint(BACKEND).remoteEndpoint(kafka).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 35 with Kind

use of zipkin2.Span.Kind in project zipkin by openzipkin.

the class V1SpanConverterTest method convert_sa.

@Test
public void convert_sa() {
    V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).addAnnotation(1472470996199000L, "cs", FRONTEND).addBinaryAnnotation("sa", BACKEND).build();
    Span v2 = Span.newBuilder().traceId("1").id("2").kind(Kind.CLIENT).timestamp(1472470996199000L).localEndpoint(FRONTEND).remoteEndpoint(BACKEND).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Aggregations

Span (zipkin2.Span)82 Test (org.junit.Test)54 Endpoint (zipkin2.Endpoint)25 Test (org.junit.jupiter.api.Test)17 V1Span (zipkin2.v1.V1Span)10 TraceSpan (com.google.devtools.cloudtrace.v1.TraceSpan)8 IOException (java.io.IOException)6 Map (java.util.Map)5 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)5 Tracer (brave.Tracer)4 Tracing (brave.Tracing)4 Trace (com.google.devtools.cloudtrace.v1.Trace)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)4 Before (org.junit.Before)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 Span (brave.Span)3 Sampler (brave.sampler.Sampler)3 Annotation (zipkin2.Annotation)3