use of io.opencensus.proto.trace.v1.Span in project zipkin by openzipkin.
the class V2SpanWriterTest method omitsEmptySpanName.
@Test
public void omitsEmptySpanName() {
Span span = Span.newBuilder().traceId("7180c278b62e8f6a216a2aea45d08fc9").parentId("6b221d5bc9e6496c").id("5b4185666d50f68b").build();
writer.write(span, buf);
assertThat(new String(bytes, UTF_8)).doesNotContain("name");
}
use of io.opencensus.proto.trace.v1.Span in project zipkin by openzipkin.
the class SpanConverterTest method onlyAddressAnnotations.
@Test
public void onlyAddressAnnotations() {
V1Span v1 = V1Span.newBuilder().traceId(1).parentId(2).id(3).name("rpc").addBinaryAnnotation("ca", FRONTEND).addBinaryAnnotation("sa", BACKEND).build();
Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("rpc").localEndpoint(FRONTEND).remoteEndpoint(BACKEND).build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
use of io.opencensus.proto.trace.v1.Span in project zipkin by openzipkin.
the class SpanConverterTest method lateRemoteEndpoint_ss.
/**
* Late flushed data on a v2 span
*/
@Test
public void lateRemoteEndpoint_ss() {
Span v2 = Span.newBuilder().traceId("1").id("2").name("get").kind(Kind.SERVER).localEndpoint(BACKEND).remoteEndpoint(FRONTEND).addAnnotation(1472470996199000L, "ss").build();
V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).name("get").addAnnotation(1472470996199000L, "ss", BACKEND).addBinaryAnnotation("ca", FRONTEND).build();
assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
use of io.opencensus.proto.trace.v1.Span in project zipkin by openzipkin.
the class SpanConverterTest method missingEndpoints_coreAnnotation.
/**
* No special treatment for invalid core annotations: missing endpoint
*/
@Test
public void missingEndpoints_coreAnnotation() {
Span v2 = Span.newBuilder().traceId("1").parentId("1").id("2").name("foo").timestamp(1472470996199000L).addAnnotation(1472470996199000L, "sr").build();
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(1L).id(2L).name("foo").timestamp(1472470996199000L).addAnnotation(1472470996199000L, "sr", null).build();
assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
use of io.opencensus.proto.trace.v1.Span in project zipkin by openzipkin.
the class SpanConverterTest method server_incomplete_shared.
@Test
public void server_incomplete_shared() {
Span v2 = Span.newBuilder().traceId("1").parentId('2').id("3").name("get").kind(Kind.SERVER).shared(true).localEndpoint(BACKEND).timestamp(1472470996199000L).build();
V1Span v1 = V1Span.newBuilder().traceId("1").parentId('2').id("3").name("get").addAnnotation(1472470996199000L, "sr", BACKEND).build();
assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Aggregations