Search in sources :

Example 1 with InsertEntry

use of zipkin2.storage.cassandra.internal.call.InsertEntry 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 2 with InsertEntry

use of zipkin2.storage.cassandra.internal.call.InsertEntry in project zipkin by openzipkin.

the class CassandraSpanConsumerTest method serviceSpanKeys.

@Test
public void serviceSpanKeys() {
    Span span = spanWithoutAnnotationsOrTags;
    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()));
}
Also used : AggregateCall(zipkin2.internal.AggregateCall) InsertEntry(zipkin2.storage.cassandra.internal.call.InsertEntry) Span(zipkin2.Span) Test(org.junit.Test)

Example 3 with InsertEntry

use of zipkin2.storage.cassandra.internal.call.InsertEntry in project zipkin by openzipkin.

the class ITSpanConsumer method insertEntry_niceToString.

/**
 * It is easier to use a real Cassandra connection than mock a prepared statement.
 */
@Test
public void insertEntry_niceToString() {
    // This test can use fake data as it is never written to cassandra
    Span clientSpan = CLIENT_SPAN;
    AggregateCall<?, ?> acceptCall = (AggregateCall<?, ?>) storage.spanConsumer().accept(asList(clientSpan));
    List<Call<?>> insertEntryCalls = acceptCall.delegate().stream().filter(c -> c instanceof InsertEntry).collect(Collectors.toList());
    assertThat(insertEntryCalls.get(0)).hasToString("INSERT INTO span_by_service (service, span) VALUES (frontend,get)");
    assertThat(insertEntryCalls.get(1)).hasToString("INSERT INTO remote_service_by_service (service, remote_service) VALUES (frontend,backend)");
}
Also used : AggregateCall(zipkin2.internal.AggregateCall) IntStream(java.util.stream.IntStream) TestObjects.spanBuilder(zipkin2.TestObjects.spanBuilder) TestObjects.newClientSpan(zipkin2.TestObjects.newClientSpan) AggregateCall(zipkin2.internal.AggregateCall) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Span(zipkin2.Span) InsertEntry(zipkin2.storage.cassandra.internal.call.InsertEntry) CLIENT_SPAN(zipkin2.TestObjects.CLIENT_SPAN) Collectors(java.util.stream.Collectors) TestInfo(org.junit.jupiter.api.TestInfo) Test(org.junit.jupiter.api.Test) List(java.util.List) Arrays.asList(java.util.Arrays.asList) SERVER(zipkin2.Span.Kind.SERVER) StorageComponent(zipkin2.storage.StorageComponent) Call(zipkin2.Call) ITStorage(zipkin2.storage.ITStorage) AggregateCall(zipkin2.internal.AggregateCall) Call(zipkin2.Call) InsertEntry(zipkin2.storage.cassandra.internal.call.InsertEntry) TestObjects.newClientSpan(zipkin2.TestObjects.newClientSpan) Span(zipkin2.Span) Test(org.junit.jupiter.api.Test)

Aggregations

Span (zipkin2.Span)3 AggregateCall (zipkin2.internal.AggregateCall)3 InsertEntry (zipkin2.storage.cassandra.internal.call.InsertEntry)3 Test (org.junit.Test)2 Arrays.asList (java.util.Arrays.asList)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 IntStream (java.util.stream.IntStream)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Test (org.junit.jupiter.api.Test)1 TestInfo (org.junit.jupiter.api.TestInfo)1 Call (zipkin2.Call)1 SERVER (zipkin2.Span.Kind.SERVER)1 CLIENT_SPAN (zipkin2.TestObjects.CLIENT_SPAN)1 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)1 TestObjects.spanBuilder (zipkin2.TestObjects.spanBuilder)1 ITStorage (zipkin2.storage.ITStorage)1 StorageComponent (zipkin2.storage.StorageComponent)1