Search in sources :

Example 96 with Span

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

the class SpanConverterTest method clientAndServer.

@Test
public void clientAndServer() {
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996199000L, "cs", FRONTEND).addAnnotation(1472470996238000L, "ws", FRONTEND).addAnnotation(1472470996250000L, "sr", BACKEND).addAnnotation(1472470996350000L, "ss", BACKEND).addAnnotation(1472470996403000L, "wr", FRONTEND).addAnnotation(1472470996406000L, "cr", FRONTEND).addBinaryAnnotation("http.path", "/api", FRONTEND).addBinaryAnnotation("http.path", "/BACKEND", BACKEND).addBinaryAnnotation("clnt/finagle.version", "6.45.0", FRONTEND).addBinaryAnnotation("srv/finagle.version", "6.44.0", BACKEND).addBinaryAnnotation("ca", FRONTEND).addBinaryAnnotation("sa", BACKEND).build();
    Span.Builder newBuilder = Span.newBuilder().traceId("1").parentId("2").id("3").name("get");
    // the v1 side owns timestamp and duration
    Span clientV2 = newBuilder.clone().kind(Kind.CLIENT).localEndpoint(FRONTEND).remoteEndpoint(BACKEND).timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996238000L, "ws").addAnnotation(1472470996403000L, "wr").putTag("http.path", "/api").putTag("clnt/finagle.version", "6.45.0").build();
    // notice v1 tags are different than the v1, and the v1's annotations aren't here
    Span serverV2 = newBuilder.clone().kind(Kind.SERVER).shared(true).localEndpoint(BACKEND).remoteEndpoint(FRONTEND).timestamp(1472470996250000L).duration(100000L).putTag("http.path", "/BACKEND").putTag("srv/finagle.version", "6.44.0").build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(clientV2, serverV2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 97 with Span

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

the class SpanConverterTest method localSpan_emptyComponent.

@Test
public void localSpan_emptyComponent() {
    Span v2 = Span.newBuilder().traceId("1").id("2").name("local").localEndpoint(Endpoint.newBuilder().serviceName("frontend").build()).timestamp(1472470996199000L).duration(207000L).build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).name("local").timestamp(1472470996199000L).duration(207000L).addBinaryAnnotation("lc", "", Endpoint.newBuilder().serviceName("frontend").build()).build();
    assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 98 with Span

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

the class SpanConverterTest method server.

@Test
public void server() {
    Span v2 = Span.newBuilder().traceId("1").id("2").name("get").kind(Kind.SERVER).localEndpoint(BACKEND).remoteEndpoint(FRONTEND).timestamp(1472470996199000L).duration(207000L).putTag("http.path", "/api").putTag("finagle.version", "6.45.0").build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996199000L, "sr", BACKEND).addAnnotation(1472470996406000L, "ss", BACKEND).addBinaryAnnotation("http.path", "/api", BACKEND).addBinaryAnnotation("finagle.version", "6.45.0", 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 99 with Span

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

the class SpanConverterTest method oneway_loopback.

@Test
public void oneway_loopback() {
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").addAnnotation(1472470996199000L, "cs", FRONTEND).addAnnotation(1472470996250000L, "sr", FRONTEND).build();
    Span.Builder newBuilder = Span.newBuilder().traceId("1").parentId("2").id("3").name("get");
    Span clientV2 = newBuilder.clone().kind(Kind.CLIENT).localEndpoint(FRONTEND).timestamp(1472470996199000L).build();
    Span serverV2 = newBuilder.clone().kind(Kind.SERVER).shared(true).localEndpoint(FRONTEND).timestamp(1472470996250000L).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(clientV2, serverV2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 100 with Span

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

the class SpanConverterTest method clientAndServer_loopback.

@Test
public void clientAndServer_loopback() {
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996199000L, "cs", FRONTEND).addAnnotation(1472470996250000L, "sr", FRONTEND).addAnnotation(1472470996350000L, "ss", FRONTEND).addAnnotation(1472470996406000L, "cr", FRONTEND).build();
    Span.Builder newBuilder = Span.newBuilder().traceId("1").parentId("2").id("3").name("get");
    Span clientV2 = newBuilder.clone().kind(Kind.CLIENT).localEndpoint(FRONTEND).timestamp(1472470996199000L).duration(207000L).build();
    Span serverV2 = newBuilder.clone().kind(Kind.SERVER).shared(true).localEndpoint(FRONTEND).timestamp(1472470996250000L).duration(100000L).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(clientV2, serverV2);
}
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