Search in sources :

Example 51 with Span

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

the class ZipkinRuleTest method getTraces_whenMissingTimestamps.

/**
 * The rule is here to help debugging. Even partial spans should be returned
 */
@Test
public void getTraces_whenMissingTimestamps() throws IOException {
    Span span = Span.newBuilder().traceId("1").id("1").name("foo").build();
    // write the span to the zipkin using http
    assertThat(postSpansV1(asList(span)).code()).isEqualTo(202);
    // read the traces directly
    assertThat(zipkin.getTraces()).containsOnly(asList(span));
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 52 with Span

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

the class CassandraSpanConsumerTest method traceByServiceSpan_indexesLocalServiceNameAndEmptySpanName.

/**
 * To allow lookups w/o a span name, we index "". "" is used instead of null to avoid creating
 * tombstones.
 */
@Test
public void traceByServiceSpan_indexesLocalServiceNameAndEmptySpanName() {
    Span span = spanWithoutAnnotationsOrTags;
    AggregateCall<?, Void> call = (AggregateCall<?, Void>) consumer.accept(singletonList(span));
    assertThat(call.delegate()).filteredOn(c -> c instanceof InsertTraceByServiceSpan).extracting("input.service", "input.span").containsExactly(tuple(FRONTEND.serviceName(), span.name()), tuple(FRONTEND.serviceName(), ""));
}
Also used : AggregateCall(zipkin2.internal.AggregateCall) Span(zipkin2.Span) Test(org.junit.Test)

Example 53 with Span

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

the class CassandraSpanConsumerTest method strictTraceIdFalse_setsTraceIdHigh.

@Test
public void strictTraceIdFalse_setsTraceIdHigh() {
    consumer = spanConsumer(CassandraStorage.newBuilder().strictTraceId(false));
    Span span = spanWithoutAnnotationsOrTags.toBuilder().traceId("77fcac3d4c5be8d2a037812820c65f28").build();
    AggregateCall<?, Void> call = (AggregateCall<?, Void>) consumer.accept(singletonList(span));
    assertThat(call.delegate()).filteredOn(c -> c instanceof InsertSpan).extracting("input.trace_id_high", "input.trace_id").containsExactly(tuple("77fcac3d4c5be8d2", "a037812820c65f28"));
}
Also used : AggregateCall(zipkin2.internal.AggregateCall) Span(zipkin2.Span) Test(org.junit.Test)

Example 54 with Span

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

the class CassandraSpanConsumerTest method serviceSpanKeys_emptyWhenNoEndpoints.

@Test
public void serviceSpanKeys_emptyWhenNoEndpoints() {
    Span span = spanWithoutAnnotationsOrTags.toBuilder().localEndpoint(null).build();
    assertThat(consumer.accept(singletonList(span))).isInstanceOf(ResultSetFutureCall.class);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 55 with Span

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

the class CassandraSpanConsumerTest method doesntSetTraceIdHigh_128.

@Test
public void doesntSetTraceIdHigh_128() {
    Span span = spanWithoutAnnotationsOrTags.toBuilder().traceId("77fcac3d4c5be8d2a037812820c65f28").build();
    AggregateCall<?, Void> call = (AggregateCall<?, Void>) consumer.accept(singletonList(span));
    assertThat(call.delegate()).filteredOn(c -> c instanceof InsertSpan).extracting("input.trace_id_high", "input.trace_id").containsExactly(tuple(null, span.traceId()));
}
Also used : AggregateCall(zipkin2.internal.AggregateCall) Span(zipkin2.Span) Test(org.junit.Test)

Aggregations

Span (zipkin2.Span)290 Test (org.junit.Test)192 Test (org.junit.jupiter.api.Test)67 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)41 Endpoint (zipkin2.Endpoint)37 ArrayList (java.util.ArrayList)24 V1Span (zipkin2.v1.V1Span)17 List (java.util.List)14 AggregateCall (zipkin2.internal.AggregateCall)13 TraceSpan (com.google.devtools.cloudtrace.v1.TraceSpan)12 Arrays.asList (java.util.Arrays.asList)9 Map (java.util.Map)9 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)9 Span (com.google.devtools.cloudtrace.v2.Span)8 LinkedHashMap (java.util.LinkedHashMap)8 Trace (com.google.devtools.cloudtrace.v1.Trace)7 Span (zipkin2.proto3.Span)7 SpanData (io.opencensus.trace.export.SpanData)6 SpanCustomizer (brave.SpanCustomizer)5 IOException (java.io.IOException)5