Search in sources :

Example 71 with Span

use of io.opentelemetry.proto.trace.v1.Span in project zipkin by openzipkin.

the class V1JsonSpanWriterTest method writesEmptyServiceName.

@Test
public void writesEmptyServiceName() {
    Span span = CLIENT_SPAN.toBuilder().localEndpoint(Endpoint.newBuilder().ip("127.0.0.1").build()).build();
    writer.write(span, buf);
    assertThat(new String(bytes, UTF_8)).contains("\"value\":\"foo\",\"endpoint\":{\"serviceName\":\"\",\"ipv4\":\"127.0.0.1\"}");
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 72 with Span

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

Example 73 with Span

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

Example 74 with Span

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

Example 75 with Span

use of io.opentelemetry.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);
}
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