use of zipkin2.v1.V1Span in project zipkin by openzipkin.
the class SpanConverterTest method client_kindInferredFromAnnotation.
@Test
public void client_kindInferredFromAnnotation() {
Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("get").localEndpoint(FRONTEND).timestamp(1472470996199000L).duration(1472470996238000L - 1472470996199000L).addAnnotation(1472470996199000L, "cs").build();
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).duration(1472470996238000L - 1472470996199000L).addAnnotation(1472470996199000L, "cs", FRONTEND).addAnnotation(1472470996238000L, "cr", FRONTEND).build();
assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
}
use of zipkin2.v1.V1Span 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.v1.V1Span 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);
}
use of zipkin2.v1.V1Span in project zipkin by openzipkin.
the class ThriftCodec method readOne.
@Nullable
public static Span readOne(ReadBuffer buffer) {
if (buffer.available() == 0)
return null;
try {
V1Span v1Span = new V1ThriftSpanReader().read(buffer);
List<Span> out = new ArrayList<Span>(1);
V1SpanConverter.create().convert(v1Span, out);
return out.get(0);
} catch (Exception e) {
throw exceptionReading("Span", e);
}
}
use of zipkin2.v1.V1Span in project zipkin by openzipkin.
the class ThriftCodec method readList.
public static boolean readList(ReadBuffer buffer, Collection<Span> out) {
int length = buffer.available();
if (length == 0)
return false;
try {
int listLength = readListLength(buffer);
if (listLength == 0)
return false;
V1ThriftSpanReader reader = new V1ThriftSpanReader();
V1SpanConverter converter = V1SpanConverter.create();
for (int i = 0; i < listLength; i++) {
V1Span v1Span = reader.read(buffer);
converter.convert(v1Span, out);
}
} catch (Exception e) {
throw exceptionReading("List<Span>", e);
}
return true;
}
Aggregations