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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations