Search in sources :

Example 91 with Span

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

the class V2SpanWriterTest method omitsEmptySpanName.

@Test
public void omitsEmptySpanName() {
    Span span = Span.newBuilder().traceId("7180c278b62e8f6a216a2aea45d08fc9").parentId("6b221d5bc9e6496c").id("5b4185666d50f68b").build();
    writer.write(span, buf);
    assertThat(new String(bytes, UTF_8)).doesNotContain("name");
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 92 with Span

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

the class SpanConverterTest method onlyAddressAnnotations.

@Test
public void onlyAddressAnnotations() {
    V1Span v1 = V1Span.newBuilder().traceId(1).parentId(2).id(3).name("rpc").addBinaryAnnotation("ca", FRONTEND).addBinaryAnnotation("sa", BACKEND).build();
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("rpc").localEndpoint(FRONTEND).remoteEndpoint(BACKEND).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 93 with Span

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

the class SpanConverterTest method lateRemoteEndpoint_ss.

/**
 * Late flushed data on a v2 span
 */
@Test
public void lateRemoteEndpoint_ss() {
    Span v2 = Span.newBuilder().traceId("1").id("2").name("get").kind(Kind.SERVER).localEndpoint(BACKEND).remoteEndpoint(FRONTEND).addAnnotation(1472470996199000L, "ss").build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).name("get").addAnnotation(1472470996199000L, "ss", BACKEND).addBinaryAnnotation("ca", FRONTEND).build();
    assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 94 with Span

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

the class SpanConverterTest method missingEndpoints_coreAnnotation.

/**
 * No special treatment for invalid core annotations: missing endpoint
 */
@Test
public void missingEndpoints_coreAnnotation() {
    Span v2 = Span.newBuilder().traceId("1").parentId("1").id("2").name("foo").timestamp(1472470996199000L).addAnnotation(1472470996199000L, "sr").build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(1L).id(2L).name("foo").timestamp(1472470996199000L).addAnnotation(1472470996199000L, "sr", null).build();
    assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 95 with Span

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

the class SpanConverterTest method server_incomplete_shared.

@Test
public void server_incomplete_shared() {
    Span v2 = Span.newBuilder().traceId("1").parentId('2').id("3").name("get").kind(Kind.SERVER).shared(true).localEndpoint(BACKEND).timestamp(1472470996199000L).build();
    V1Span v1 = V1Span.newBuilder().traceId("1").parentId('2').id("3").name("get").addAnnotation(1472470996199000L, "sr", BACKEND).build();
    assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Aggregations

Span (zipkin2.Span)290 Test (org.junit.Test)203 Test (org.junit.jupiter.api.Test)69 Endpoint (zipkin2.Endpoint)62 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)41 ArrayList (java.util.ArrayList)29 V1Span (zipkin2.v1.V1Span)23 List (java.util.List)19 Map (java.util.Map)18 Annotation (zipkin2.Annotation)13 AggregateCall (zipkin2.internal.AggregateCall)13 TraceSpan (com.google.devtools.cloudtrace.v1.TraceSpan)12 IOException (java.io.IOException)10 LinkedHashMap (java.util.LinkedHashMap)10 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)10 Arrays.asList (java.util.Arrays.asList)9 Span (com.google.devtools.cloudtrace.v2.Span)8 Trace (com.google.devtools.cloudtrace.v1.Trace)7 Call (zipkin2.Call)7 Span (zipkin2.proto3.Span)7