Search in sources :

Example 86 with Span

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);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 87 with Span

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);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 88 with Span

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);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 89 with Span

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);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 90 with Span

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);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Aggregations

Span (zipkin2.Span)335 Test (org.junit.Test)237 Test (org.junit.jupiter.api.Test)84 ArrayList (java.util.ArrayList)47 Endpoint (zipkin2.Endpoint)43 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)41 Span (io.opentelemetry.proto.trace.v1.Span)35 List (java.util.List)23 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)20 V1Span (zipkin2.v1.V1Span)17 Span (com.google.devtools.cloudtrace.v2.Span)16 Map (java.util.Map)14 AggregateCall (zipkin2.internal.AggregateCall)13 ResourceSpans (io.opentelemetry.proto.trace.v1.ResourceSpans)11 Arrays.asList (java.util.Arrays.asList)11 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)11 Annotation (wavefront.report.Annotation)11 Trace (com.google.devtools.cloudtrace.v1.Trace)10 TraceSpan (com.google.devtools.cloudtrace.v1.TraceSpan)10 AttributeValue (com.google.devtools.cloudtrace.v2.AttributeValue)10