use of zipkin.storage.QueryRequest in project zipkin by openzipkin.
the class ZipkinDispatcherTest method toQueryRequest.
@Test
public void toQueryRequest() {
HttpUrl url = baseUrl.newBuilder().addQueryParameter("serviceName", "zipkin-server").addQueryParameter("spanName", "get").addQueryParameter("limit", "1000").build();
QueryRequest request = ZipkinDispatcher.toQueryRequest(url);
assertThat(request.serviceName).isEqualTo("zipkin-server");
assertThat(request.spanName).isEqualTo("get");
assertThat(request.limit).isEqualTo(1000);
}
use of zipkin.storage.QueryRequest in project zipkin by openzipkin.
the class ZipkinDispatcherTest method toQueryRequest_parseAnnotations.
@Test
public void toQueryRequest_parseAnnotations() {
HttpUrl url = baseUrl.newBuilder().addQueryParameter("serviceName", "zipkin-server").addQueryParameter("annotationQuery", "error and finagle.timeout").build();
QueryRequest request = ZipkinDispatcher.toQueryRequest(url);
assertThat(request.annotations).containsExactly(Constants.ERROR, "finagle.timeout");
}
use of zipkin.storage.QueryRequest in project zipkin by openzipkin.
the class CassandraSpanStoreTest method searchingByAnnotationShouldFilterBeforeLimiting.
@Test
public void searchingByAnnotationShouldFilterBeforeLimiting() {
long now = System.currentTimeMillis();
int queryLimit = 2;
Endpoint endpoint = TestObjects.LOTS_OF_SPANS[0].annotations.get(0).endpoint;
BinaryAnnotation ba = BinaryAnnotation.create("host.name", "host1", endpoint);
int nbTraceFetched = queryLimit * storage.indexFetchMultiplier;
IntStream.range(0, nbTraceFetched).forEach(i -> accept(TestObjects.LOTS_OF_SPANS[i++].toBuilder().timestamp(now - (i * 1000)).build()));
// Add two traces with the binary annotation we're looking for
IntStream.range(nbTraceFetched, nbTraceFetched + 2).forEach(i -> accept(TestObjects.LOTS_OF_SPANS[i++].toBuilder().timestamp(now - (i * 1000)).addBinaryAnnotation(ba).build()));
QueryRequest queryRequest = QueryRequest.builder().addBinaryAnnotation(ba.key, new String(ba.value, Util.UTF_8)).serviceName(endpoint.serviceName).limit(queryLimit).build();
assertThat(store().getTraces(queryRequest)).hasSize(queryLimit);
}
use of zipkin.storage.QueryRequest in project zipkin by openzipkin.
the class InternalGuavaSpanStoreAdapterTest method getTraces_exception.
@Test
public void getTraces_exception() throws Exception {
QueryRequest request = QueryRequest.builder().build();
doAnswer(answer(c -> c.onError(new IllegalStateException("failed")))).when(asyncSpanStore).getTraces(eq(request), any(Callback.class));
thrown.expect(ExecutionException.class);
thrown.expectCause(isA(IllegalStateException.class));
spanStore.getTraces(request).get();
}
use of zipkin.storage.QueryRequest in project zipkin by openzipkin.
the class InternalGuavaSpanStoreAdapterTest method getTraces_success.
@Test
public void getTraces_success() throws Exception {
QueryRequest request = QueryRequest.builder().build();
doAnswer(answer(c -> c.onSuccess(asList(TRACE)))).when(asyncSpanStore).getTraces(eq(request), any(Callback.class));
assertThat(spanStore.getTraces(request).get()).containsExactly(TRACE);
}
Aggregations