Search in sources :

Example 41 with BACKEND

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

the class SpanConverterTest method dataMissingEndpointGoesOnFirstSpan.

@Test
public void dataMissingEndpointGoesOnFirstSpan() {
    V1Span v1 = V1Span.newBuilder().traceId(1).id(2).name("missing").addAnnotation(1472470996199000L, "foo", FRONTEND).addAnnotation(1472470996238000L, "bar", FRONTEND).addAnnotation(1472470996250000L, "baz", BACKEND).addAnnotation(1472470996350000L, "qux", BACKEND).addAnnotation(1472470996403000L, "missing", null).addBinaryAnnotation("foo", "bar", FRONTEND).addBinaryAnnotation("baz", "qux", BACKEND).addBinaryAnnotation("missing", "", null).build();
    Span.Builder newBuilder = Span.newBuilder().traceId("1").id("2").name("missing");
    Span first = newBuilder.clone().localEndpoint(FRONTEND).addAnnotation(1472470996199000L, "foo").addAnnotation(1472470996238000L, "bar").addAnnotation(1472470996403000L, "missing").putTag("foo", "bar").putTag("missing", "").build();
    Span second = newBuilder.clone().localEndpoint(BACKEND).addAnnotation(1472470996250000L, "baz").addAnnotation(1472470996350000L, "qux").putTag("baz", "qux").build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(first, second);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 42 with BACKEND

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

the class SpanConverterTest method lateRemoteEndpoint_sa.

@Test
public void lateRemoteEndpoint_sa() {
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").remoteEndpoint(BACKEND).build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).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)

Example 43 with BACKEND

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

the class SpanConverterTest method lateRemoteEndpoint_cr.

@Test
public void lateRemoteEndpoint_cr() {
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("get").kind(Kind.CLIENT).localEndpoint(FRONTEND).remoteEndpoint(BACKEND).addAnnotation(1472470996199000L, "cr").build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").addAnnotation(1472470996199000L, "cr", 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)

Example 44 with BACKEND

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

the class SpanConverterTest method assumesServerWithoutTimestampIsShared.

/**
 * The old v1 format had no means of saying it is shared or not. This uses lack of timestamp as a
 * signal
 */
@Test
public void assumesServerWithoutTimestampIsShared() {
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").addAnnotation(1472470996250000L, "sr", BACKEND).addAnnotation(1472470996350000L, "ss", BACKEND).build();
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("get").kind(Kind.SERVER).shared(true).localEndpoint(BACKEND).timestamp(1472470996250000L).duration(100000L).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 45 with BACKEND

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

the class SpanConverterTest method redundantServiceNameOnAddressAnnotations_serverRetainsClientSocket.

@Test
public void redundantServiceNameOnAddressAnnotations_serverRetainsClientSocket() {
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").kind(Kind.SERVER).name("get").localEndpoint(BACKEND).remoteEndpoint(FRONTEND.toBuilder().serviceName(null).build()).timestamp(1472470996199000L).duration(207000L).build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996199000L, "sr", BACKEND).addAnnotation(1472470996406000L, "ss", BACKEND).addBinaryAnnotation("ca", FRONTEND.toBuilder().serviceName("backend").build()).addBinaryAnnotation("sa", BACKEND).build();
    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