use of io.opentelemetry.proto.trace.v1.Span in project zipkin by openzipkin.
the class SpanConverterTest method producerAndConsumer.
/**
* shared v1 IDs for messaging spans isn't supported, but shouldn't break
*/
@Test
public void producerAndConsumer() {
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("whatev").addAnnotation(1472470996199000L, "ms", FRONTEND).addAnnotation(1472470996238000L, "ws", FRONTEND).addAnnotation(1472470996403000L, "wr", BACKEND).addAnnotation(1472470996406000L, "mr", BACKEND).addBinaryAnnotation("ma", kafka).build();
Span.Builder newBuilder = Span.newBuilder().traceId("1").parentId("2").id("3").name("whatev");
Span producer = newBuilder.clone().kind(Kind.PRODUCER).localEndpoint(FRONTEND).remoteEndpoint(kafka).timestamp(1472470996199000L).duration(1472470996238000L - 1472470996199000L).build();
Span consumer = newBuilder.clone().kind(Kind.CONSUMER).shared(true).localEndpoint(BACKEND).remoteEndpoint(kafka).timestamp(1472470996403000L).duration(1472470996406000L - 1472470996403000L).build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(producer, consumer);
}
use of io.opentelemetry.proto.trace.v1.Span in project zipkin by openzipkin.
the class SpanConverterTest method producer.
@Test
public void producer() {
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("send").addAnnotation(1472470996199000L, "ms", FRONTEND).build();
Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("send").kind(Kind.PRODUCER).localEndpoint(FRONTEND).timestamp(1472470996199000L).build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
use of io.opentelemetry.proto.trace.v1.Span in project zipkin by openzipkin.
the class SpanConverterTest method client_missingCs.
/**
* Fix a v1 reported half in new style and half in old style, ex via a bridge
*/
@Test
public void client_missingCs() {
Span v2 = Span.newBuilder().traceId("1").id("2").name("get").kind(Kind.CLIENT).localEndpoint(FRONTEND).timestamp(1472470996199000L).duration(207000L).build();
V1Span v1 = V1Span.newBuilder().traceId("1").id("2").name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996406000L, "cs", FRONTEND).build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
use of io.opentelemetry.proto.trace.v1.Span in project zipkin by openzipkin.
the class SpanConverterTest method consumer.
@Test
public void consumer() {
Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("next-message").kind(Kind.CONSUMER).localEndpoint(BACKEND).timestamp(1472470996199000L).build();
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("next-message").timestamp(1472470996199000L).addAnnotation(1472470996199000L, "mr", BACKEND).build();
assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
use of io.opentelemetry.proto.trace.v1.Span in project zipkin by openzipkin.
the class SpanConverterTest method redundantServiceNameOnAddressAnnotations_server.
/**
* On server spans, ignore service name on remote address binary annotation that appear loopback
* based on the service name. This could happen when finagle service labels are used incorrectly,
* which as common in early instrumentation.
*
* <p>This prevents an uncorrectable scenario which results in extra (loopback) links on server
* spans.
*/
@Test
public void redundantServiceNameOnAddressAnnotations_server() {
Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").kind(Kind.SERVER).name("get").localEndpoint(FRONTEND).timestamp(1472470996199000L).duration(207000L).build();
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996199000L, "sr", FRONTEND).addAnnotation(1472470996406000L, "ss", FRONTEND).addBinaryAnnotation("ca", FRONTEND).addBinaryAnnotation("sa", FRONTEND).build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Aggregations