Search in sources :

Example 36 with FRONTEND

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

the class SpanConverterTest method producer_duration.

@Test
public void producer_duration() {
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("send").kind(Kind.PRODUCER).localEndpoint(FRONTEND).timestamp(1472470996199000L).duration(51000L).build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("send").timestamp(1472470996199000L).duration(51000L).addAnnotation(1472470996199000L, "ms", FRONTEND).addAnnotation(1472470996250000L, "ws", 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 37 with FRONTEND

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

the class SpanConverterTest method noAnnotationsExceptAddresses.

@Test
public void noAnnotationsExceptAddresses() {
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("get").localEndpoint(FRONTEND).remoteEndpoint(BACKEND).timestamp(1472470996199000L).duration(207000L).build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).duration(207000L).addBinaryAnnotation("lc", "", 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 38 with FRONTEND

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

the class ITSpanConsumer method insertEntry_niceToString.

/**
 * It is easier to use a real Cassandra connection than mock a prepared statement.
 */
@Test
public void insertEntry_niceToString() {
    // This test can use fake data as it is never written to cassandra
    Span clientSpan = CLIENT_SPAN;
    AggregateCall<?, ?> acceptCall = (AggregateCall<?, ?>) storage.spanConsumer().accept(asList(clientSpan));
    List<Call<?>> insertEntryCalls = acceptCall.delegate().stream().filter(c -> c instanceof InsertEntry).collect(Collectors.toList());
    assertThat(insertEntryCalls.get(0)).hasToString("INSERT INTO span_by_service (service, span) VALUES (frontend,get)");
    assertThat(insertEntryCalls.get(1)).hasToString("INSERT INTO remote_service_by_service (service, remote_service) VALUES (frontend,backend)");
}
Also used : AggregateCall(zipkin2.internal.AggregateCall) IntStream(java.util.stream.IntStream) TestObjects.spanBuilder(zipkin2.TestObjects.spanBuilder) TestObjects.newClientSpan(zipkin2.TestObjects.newClientSpan) AggregateCall(zipkin2.internal.AggregateCall) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Span(zipkin2.Span) InsertEntry(zipkin2.storage.cassandra.internal.call.InsertEntry) CLIENT_SPAN(zipkin2.TestObjects.CLIENT_SPAN) Collectors(java.util.stream.Collectors) TestInfo(org.junit.jupiter.api.TestInfo) Test(org.junit.jupiter.api.Test) List(java.util.List) Arrays.asList(java.util.Arrays.asList) SERVER(zipkin2.Span.Kind.SERVER) StorageComponent(zipkin2.storage.StorageComponent) Call(zipkin2.Call) ITStorage(zipkin2.storage.ITStorage) AggregateCall(zipkin2.internal.AggregateCall) Call(zipkin2.Call) InsertEntry(zipkin2.storage.cassandra.internal.call.InsertEntry) TestObjects.newClientSpan(zipkin2.TestObjects.newClientSpan) Span(zipkin2.Span) Test(org.junit.jupiter.api.Test)

Example 39 with FRONTEND

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

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

the class SpanConverterTest method producerAndConsumer_loopback_shared.

/**
 * shared v1 IDs for messaging spans isn't supported, but shouldn't break
 */
@Test
public void producerAndConsumer_loopback_shared() {
    V1Span v1 = V1Span.newBuilder().traceId(1).parentId(2).id(3).name("message").addAnnotation(1472470996199000L, "ms", FRONTEND).addAnnotation(1472470996238000L, "ws", FRONTEND).addAnnotation(1472470996403000L, "wr", FRONTEND).addAnnotation(1472470996406000L, "mr", FRONTEND).build();
    Span.Builder newBuilder = Span.newBuilder().traceId("1").parentId("2").id("3").name("message");
    Span producer = newBuilder.clone().kind(Kind.PRODUCER).localEndpoint(FRONTEND).timestamp(1472470996199000L).duration(1472470996238000L - 1472470996199000L).build();
    Span consumer = newBuilder.clone().kind(Kind.CONSUMER).shared(true).localEndpoint(FRONTEND).timestamp(1472470996403000L).duration(1472470996406000L - 1472470996403000L).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(producer, consumer);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Aggregations

Span (zipkin2.Span)50 Test (org.junit.Test)35 Endpoint (zipkin2.Endpoint)21 Test (org.junit.jupiter.api.Test)17 V1Span (zipkin2.v1.V1Span)12 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)6 NoopHealthCheckManager (com.wavefront.agent.channel.NoopHealthCheckManager)4 SpanSampler (com.wavefront.agent.sampler.SpanSampler)4 ByteBuf (io.netty.buffer.ByteBuf)4 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)4 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)4 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)4 Span (wavefront.report.Span)4 SpanBytesEncoder (zipkin2.codec.SpanBytesEncoder)4 Annotation (wavefront.report.Annotation)3 DurationSampler (com.wavefront.sdk.entities.tracing.sampling.DurationSampler)2 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)2 ArrayList (java.util.ArrayList)2 Arrays.asList (java.util.Arrays.asList)2 List (java.util.List)2