Search in sources :

Example 31 with V1Span

use of zipkin2.v1.V1Span in project zipkin by openzipkin.

the class V1SpanConverterTest method convert_ma_incorrect_value.

// Following 3 tests show leniency for old versions of zipkin-ruby which serialized address binary
// annotations as "1" instead of true
@Test
public void convert_ma_incorrect_value() {
    V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).addAnnotation(1472470996199000L, "mr", BACKEND).addBinaryAnnotation("ma", "1", kafka).build();
    Span v2 = Span.newBuilder().traceId("1").id("2").kind(Kind.CONSUMER).timestamp(1472470996199000L).localEndpoint(BACKEND).remoteEndpoint(kafka).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 32 with V1Span

use of zipkin2.v1.V1Span in project zipkin by openzipkin.

the class V1SpanConverterTest method convert_ca.

@Test
public void convert_ca() {
    V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).addAnnotation(1472470996199000L, "sr", BACKEND).addBinaryAnnotation("ca", FRONTEND).build();
    Span v2 = Span.newBuilder().traceId("1").id("2").kind(Kind.SERVER).timestamp(1472470996199000L).localEndpoint(BACKEND).remoteEndpoint(FRONTEND).shared(true).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 33 with V1Span

use of zipkin2.v1.V1Span in project zipkin by openzipkin.

the class V1SpanConverterTest method convert_ca_incorrect_value.

@Test
public void convert_ca_incorrect_value() {
    V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).addAnnotation(1472470996199000L, "sr", BACKEND).addBinaryAnnotation("ca", "1", FRONTEND).build();
    Span v2 = Span.newBuilder().traceId("1").id("2").kind(Kind.SERVER).timestamp(1472470996199000L).localEndpoint(BACKEND).remoteEndpoint(FRONTEND).shared(true).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 34 with V1Span

use of zipkin2.v1.V1Span in project zipkin by openzipkin.

the class SpanConverterTest method producer_remote.

@Test
public void producer_remote() {
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("send").kind(Kind.PRODUCER).localEndpoint(FRONTEND).remoteEndpoint(kafka).timestamp(1472470996199000L).build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("send").timestamp(1472470996199000L).addAnnotation(1472470996199000L, "ms", FRONTEND).addBinaryAnnotation("ma", kafka).build();
    assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 35 with V1Span

use of zipkin2.v1.V1Span 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)

Aggregations

Span (zipkin2.Span)44 Test (org.junit.Test)41 Endpoint (zipkin2.Endpoint)8 V1Span (zipkin2.v1.V1Span)7 V1BinaryAnnotation (zipkin2.v1.V1BinaryAnnotation)4 EOFException (java.io.EOFException)3 BufferUnderflowException (java.nio.BufferUnderflowException)3 V1Annotation (zipkin2.v1.V1Annotation)3 V1SpanConverter (zipkin2.v1.V1SpanConverter)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Annotation (zipkin2.Annotation)1 JsonReader (zipkin2.internal.JsonCodec.JsonReader)1