Search in sources :

Example 1 with AggregateCall

use of zipkin2.internal.AggregateCall 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 2 with AggregateCall

use of zipkin2.internal.AggregateCall 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 3 with AggregateCall

use of zipkin2.internal.AggregateCall 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)

Example 4 with AggregateCall

use of zipkin2.internal.AggregateCall in project zipkin by openzipkin.

the class CassandraSpanConsumerTest method serviceRemoteServiceKeys_addsRemoteServiceName.

@Test
public void serviceRemoteServiceKeys_addsRemoteServiceName() {
    Span span = spanWithoutAnnotationsOrTags.toBuilder().remoteEndpoint(BACKEND).build();
    AggregateCall<?, Void> call = (AggregateCall<?, Void>) consumer.accept(singletonList(span));
    assertThat(call.delegate()).filteredOn(c -> c instanceof InsertEntry).extracting("input").containsExactly(entry(FRONTEND.serviceName(), span.name()), entry(FRONTEND.serviceName(), BACKEND.serviceName()));
}
Also used : AggregateCall(zipkin2.internal.AggregateCall) InsertEntry(zipkin2.storage.cassandra.internal.call.InsertEntry) Span(zipkin2.Span) Test(org.junit.Test)

Example 5 with AggregateCall

use of zipkin2.internal.AggregateCall in project zipkin by openzipkin.

the class CassandraSpanConsumerTest method traceByServiceSpan_skipsOnNoTimestamp.

@Test
public void traceByServiceSpan_skipsOnNoTimestamp() {
    Span span = spanWithoutAnnotationsOrTags.toBuilder().timestamp(null).build();
    AggregateCall<?, Void> call = (AggregateCall<?, Void>) consumer.accept(singletonList(span));
    assertThat(call.delegate()).filteredOn(c -> c instanceof InsertTraceByServiceSpan).extracting("input.service", "input.span").isEmpty();
}
Also used : AggregateCall(zipkin2.internal.AggregateCall) Span(zipkin2.Span) Test(org.junit.Test)

Aggregations

Span (zipkin2.Span)12 AggregateCall (zipkin2.internal.AggregateCall)12 Test (org.junit.Test)11 InsertEntry (zipkin2.storage.cassandra.internal.call.InsertEntry)4 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 Call (zipkin2.Call)2 Arrays.asList (java.util.Arrays.asList)1 Collections (java.util.Collections)1 Collections.singletonList (java.util.Collections.singletonList)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 IntStream (java.util.stream.IntStream)1 Assertions.entry (org.assertj.core.api.Assertions.entry)1 Assertions.tuple (org.assertj.core.api.Assertions.tuple)1 Test (org.junit.jupiter.api.Test)1 TestInfo (org.junit.jupiter.api.TestInfo)1 SERVER (zipkin2.Span.Kind.SERVER)1 BACKEND (zipkin2.TestObjects.BACKEND)1 CLIENT_SPAN (zipkin2.TestObjects.CLIENT_SPAN)1 FRONTEND (zipkin2.TestObjects.FRONTEND)1