use of zipkin2.TestObjects.CLIENT_SPAN 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)");
}
use of zipkin2.TestObjects.CLIENT_SPAN in project zipkin by openzipkin.
the class BulkRequestBenchmarks method buildAndWriteRequest_singleSpan.
@Benchmark
public HttpRequest buildAndWriteRequest_singleSpan() {
BulkCallBuilder builder = new BulkCallBuilder(es, V6_0, "index-span");
builder.index(spanIndex, "span", CLIENT_SPAN, BulkIndexWriter.SPAN);
HttpCall.RequestSupplier supplier = builder.build().request;
HttpRequestWriter request = HttpRequest.streaming(supplier.headers());
supplier.writeBody(request::tryWrite);
return request;
}
use of zipkin2.TestObjects.CLIENT_SPAN in project zipkin by openzipkin.
the class BulkRequestBenchmarks method buildAndWriteRequest_tenSpans.
@Benchmark
public HttpRequest buildAndWriteRequest_tenSpans() {
BulkCallBuilder builder = new BulkCallBuilder(es, V6_0, "index-span");
for (int i = 0; i < 10; i++) {
builder.index(spanIndex, "span", CLIENT_SPAN, BulkIndexWriter.SPAN);
}
HttpCall.RequestSupplier supplier = builder.build().request;
HttpRequestWriter request = HttpRequest.streaming(supplier.headers());
supplier.writeBody(request::tryWrite);
return request;
}
use of zipkin2.TestObjects.CLIENT_SPAN in project zipkin by openzipkin.
the class CollectorTest method storeSpansCallback_toStringIncludesSpanIds.
@Test
public void storeSpansCallback_toStringIncludesSpanIds() {
Span span2 = CLIENT_SPAN.toBuilder().id("3").build();
when(collector.idString(span2)).thenReturn("3");
assertThat(collector.new StoreSpans(asList(CLIENT_SPAN, span2))).hasToString("StoreSpans([1, 3])");
}
Aggregations