Search in sources :

Example 46 with Span

use of zipkin.Span in project zipkin by openzipkin.

the class CorrectForClockSkewTest method getClockSkew_requiresCoreAnnotationsToHaveEndpoints.

@Test
public void getClockSkew_requiresCoreAnnotationsToHaveEndpoints() {
    Span span = Span.builder().traceId(1L).parentId(2L).id(3L).name("").addAnnotation(Annotation.create(20, CLIENT_SEND, null)).addAnnotation(Annotation.create(10, /* skew */
    SERVER_RECV, null)).addAnnotation(Annotation.create(20, SERVER_SEND, null)).addAnnotation(Annotation.create(40, CLIENT_RECV, null)).build();
    assertThat(getClockSkew(span)).isNull();
}
Also used : CorrectForClockSkew.isLocalSpan(zipkin.internal.CorrectForClockSkew.isLocalSpan) Span(zipkin.Span) Test(org.junit.Test)

Example 47 with Span

use of zipkin.Span in project zipkin by openzipkin.

the class CorrectForClockSkewTest method spanWithLCAnnotationIsLocalSpan.

@Test
public void spanWithLCAnnotationIsLocalSpan() {
    Span localSpan = localSpan(TestObjects.TRACE.get(0), WEB_ENDPOINT, 0, 0);
    assertTrue(isLocalSpan(localSpan));
}
Also used : CorrectForClockSkew.isLocalSpan(zipkin.internal.CorrectForClockSkew.isLocalSpan) Span(zipkin.Span) Test(org.junit.Test)

Example 48 with Span

use of zipkin.Span in project zipkin by openzipkin.

the class CorrectForClockSkewTest method getClockSkew_endpointIsServer.

@Test
public void getClockSkew_endpointIsServer() {
    Span span = Span.builder().traceId(1L).parentId(2L).id(3L).name("").addAnnotation(Annotation.create(20, CLIENT_SEND, WEB_ENDPOINT)).addAnnotation(Annotation.create(10, /* skew */
    SERVER_RECV, APP_ENDPOINT)).addAnnotation(Annotation.create(20, SERVER_SEND, APP_ENDPOINT)).addAnnotation(Annotation.create(40, CLIENT_RECV, WEB_ENDPOINT)).build();
    assertThat(getClockSkew(span).endpoint).isEqualTo(APP_ENDPOINT);
}
Also used : CorrectForClockSkew.isLocalSpan(zipkin.internal.CorrectForClockSkew.isLocalSpan) Span(zipkin.Span) Test(org.junit.Test)

Example 49 with Span

use of zipkin.Span in project zipkin by openzipkin.

the class GroupByTraceIdTest method sortsDescending.

@Test
public void sortsDescending() {
    Span span1 = LOTS_OF_SPANS[0].toBuilder().timestamp(1L).build();
    Span span2 = LOTS_OF_SPANS[1].toBuilder().timestamp(2L).build();
    assertThat(GroupByTraceId.apply(asList(span1, span2), false, false)).containsExactly(asList(span2), asList(span1));
}
Also used : Span(zipkin.Span) Test(org.junit.Test)

Example 50 with Span

use of zipkin.Span in project zipkin by openzipkin.

the class SpanStoreTest method getTraces_128.

@Test
public void getTraces_128() {
    Span span1 = TestObjects.TRACE.get(0).toBuilder().traceIdHigh(1L).binaryAnnotations(asList(BinaryAnnotation.create("key", "value1", WEB_ENDPOINT))).build();
    Span span2 = span1.toBuilder().traceIdHigh(2L).binaryAnnotations(asList(BinaryAnnotation.create("key", "value2", WEB_ENDPOINT))).build();
    accept(span1, span2);
    assertThat(store().getTraces(QueryRequest.builder().serviceName(WEB_ENDPOINT.serviceName).addBinaryAnnotation("key", "value2").build())).containsExactly(asList(span2));
}
Also used : Span(zipkin.Span) Test(org.junit.Test)

Aggregations

Span (zipkin.Span)104 Test (org.junit.Test)84 Endpoint (zipkin.Endpoint)21 BinaryAnnotation (zipkin.BinaryAnnotation)12 ArrayList (java.util.ArrayList)11 Annotation (zipkin.Annotation)10 CodecTest (zipkin.CodecTest)9 CorrectForClockSkew.isLocalSpan (zipkin.internal.CorrectForClockSkew.isLocalSpan)9 ByteBuffer (java.nio.ByteBuffer)8 List (java.util.List)8 Buffer (okio.Buffer)8 LinkedHashMap (java.util.LinkedHashMap)6 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)5 ImmutableList (com.google.common.collect.ImmutableList)4 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)4 LinkedList (java.util.LinkedList)4 Constants (zipkin.Constants)4 ImmutableSet (com.google.common.collect.ImmutableSet)3 IOException (java.io.IOException)3 Arrays.asList (java.util.Arrays.asList)3