Search in sources :

Example 36 with V1Span

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

the class SpanConverterTest method consumer_duration.

@Test
public void consumer_duration() {
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("next-message").kind(Kind.CONSUMER).localEndpoint(BACKEND).timestamp(1472470996199000L).duration(51000L).build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("next-message").timestamp(1472470996199000L).duration(51000L).addAnnotation(1472470996199000L, "wr", BACKEND).addAnnotation(1472470996250000L, "mr", 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 37 with V1Span

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

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

the class SpanConverterTest method server_missingSr.

@Test
public void server_missingSr() {
    Span v2 = Span.newBuilder().traceId("1").id("2").name("get").kind(Kind.SERVER).localEndpoint(BACKEND).timestamp(1472470996199000L).duration(207000L).build();
    V1Span v1 = V1Span.newBuilder().traceId("1").id("2").name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996406000L, "ss", BACKEND).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 39 with V1Span

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

the class SpanConverterTest method server_clientAddress.

/**
 * This shows a historical finagle span, which has client-side socket info.
 */
@Test
public void server_clientAddress() {
    Span v2 = Span.newBuilder().traceId("1").id("2").name("get").kind(Kind.SERVER).localEndpoint(BACKEND).remoteEndpoint(FRONTEND.toBuilder().port(63840).build()).timestamp(TODAY).duration(207000L).addAnnotation(TODAY + 500L, "Gc(9,0.PSScavenge,2015-09-17 12:37:02 +0000,304.milliseconds+762.microseconds)").putTag("srv/finagle.version", "6.28.0").shared(true).build();
    V1Span v1 = V1Span.newBuilder().traceId("1").id("2").name("get").addAnnotation(v2.timestampAsLong(), "sr", v2.localEndpoint()).addAnnotation(v2.timestampAsLong() + 500L, "Gc(9,0.PSScavenge,2015-09-17 12:37:02 +0000,304.milliseconds+762.microseconds)", v2.localEndpoint()).addAnnotation(v2.timestampAsLong() + v2.durationAsLong(), "ss", v2.localEndpoint()).addBinaryAnnotation("srv/finagle.version", "6.28.0", v2.localEndpoint().toBuilder().port(0).build()).addBinaryAnnotation("sa", v2.localEndpoint()).addBinaryAnnotation("ca", v2.remoteEndpoint()).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 40 with V1Span

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

the class SpanConverterTest method missingEndpoints.

/**
 * Buggy instrumentation can send data with missing endpoints. Make sure we can record it.
 */
@Test
public void missingEndpoints() {
    Span v2 = Span.newBuilder().traceId("1").parentId("1").id("2").name("foo").timestamp(1472470996199000L).duration(207000L).build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(1L).id(2L).name("foo").timestamp(1472470996199000L).duration(207000L).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