Search in sources :

Example 6 with BACKEND

use of zipkin2.TestObjects.BACKEND 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 7 with BACKEND

use of zipkin2.TestObjects.BACKEND 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 8 with BACKEND

use of zipkin2.TestObjects.BACKEND in project zipkin by openzipkin.

the class SpanConverterTest method server_shared_v1_no_timestamp_duration.

@Test
public void server_shared_v1_no_timestamp_duration() {
    Span v2 = Span.newBuilder().traceId("1").parentId('2').id("3").name("get").kind(Kind.SERVER).shared(true).localEndpoint(BACKEND).timestamp(1472470996199000L).duration(207000L).build();
    V1Span v1 = V1Span.newBuilder().traceId("1").parentId('2').id("3").name("get").addAnnotation(1472470996199000L, "sr", BACKEND).addAnnotation(1472470996406000L, "ss", 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 9 with BACKEND

use of zipkin2.TestObjects.BACKEND in project zipkin by openzipkin.

the class SpanConverterTest method parsesSharedFlagFromRPCSpan.

/**
 * This emulates a situation in mysql where the row representing a span has the client's timestamp
 */
@Test
public void parsesSharedFlagFromRPCSpan() {
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(10).addAnnotation(20, "sr", BACKEND).addAnnotation(30, "ss", BACKEND).build();
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("get").kind(Kind.SERVER).shared(true).localEndpoint(BACKEND).timestamp(20).duration(10L).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 10 with BACKEND

use of zipkin2.TestObjects.BACKEND in project zipkin by openzipkin.

the class SpanConverterTest method client.

@Test
public void client() {
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("get").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();
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996199000L, "cs", FRONTEND).addAnnotation(1472470996238000L, "ws", // ts order retained
    FRONTEND).addAnnotation(1472470996403000L, "wr", FRONTEND).addAnnotation(1472470996406000L, "cr", FRONTEND).addBinaryAnnotation("http.path", "/api", FRONTEND).addBinaryAnnotation("clnt/finagle.version", "6.45.0", FRONTEND).addBinaryAnnotation("sa", 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)48 Test (org.junit.Test)31 Endpoint (zipkin2.Endpoint)17 Test (org.junit.jupiter.api.Test)16 V1Span (zipkin2.v1.V1Span)13 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)4 Call (zipkin2.Call)3 AggregateCall (zipkin2.internal.AggregateCall)3 InsertEntry (zipkin2.storage.cassandra.internal.call.InsertEntry)3 ArrayList (java.util.ArrayList)2 Arrays.asList (java.util.Arrays.asList)2 List (java.util.List)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 TraceSpan (com.google.devtools.cloudtrace.v1.TraceSpan)1 NoopHealthCheckManager (com.wavefront.agent.channel.NoopHealthCheckManager)1 SpanSampler (com.wavefront.agent.sampler.SpanSampler)1 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)1 ByteBuf (io.netty.buffer.ByteBuf)1 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)1 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)1