本文整理汇总了Java中zipkin.storage.QueryRequest类的典型用法代码示例。如果您正苦于以下问题:Java QueryRequest类的具体用法?Java QueryRequest怎么用?Java QueryRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueryRequest类属于zipkin.storage包,在下文中一共展示了QueryRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTraces
import zipkin.storage.QueryRequest; //导入依赖的package包/类
@RequestMapping(value = "/traces", method = RequestMethod.GET, produces = APPLICATION_JSON_VALUE)
public String getTraces(
@RequestParam(value = "serviceName", required = false) String serviceName,
@RequestParam(value = "spanName", defaultValue = "all") String spanName,
@RequestParam(value = "annotationQuery", required = false) String annotationQuery,
@RequestParam(value = "minDuration", required = false) Long minDuration,
@RequestParam(value = "maxDuration", required = false) Long maxDuration,
@RequestParam(value = "endTs", required = false) Long endTs,
@RequestParam(value = "lookback", required = false) Long lookback,
@RequestParam(value = "limit", required = false) Integer limit) {
QueryRequest queryRequest = QueryRequest.builder()
.serviceName(serviceName)
.spanName(spanName)
.parseAnnotationQuery(annotationQuery)
.minDuration(minDuration)
.maxDuration(maxDuration)
.endTs(endTs)
.lookback(lookback != null ? lookback : defaultLookback)
.limit(limit).build();
return new String(Codec.JSON.writeTraces(storage.spanStore().getTraces(queryRequest)), UTF_8);
}
示例2: processDependencies
import zipkin.storage.QueryRequest; //导入依赖的package包/类
/**
* This processes the job as if it were a batch. For each day we had traces, run the job again.
*/
@Override public void processDependencies(List<Span> spans) {
// TODO: this avoids overrunning the cluster, though we ought to deal with this upstream
for (List<Span> nextChunk : Lists.partition(spans, 100)) {
CallbackCaptor<Void> callback = new CallbackCaptor<>();
storage().asyncSpanConsumer().accept(nextChunk, callback);
callback.get();
}
Set<Long> days = new LinkedHashSet<>();
for (List<Span> trace : storage().spanStore()
.getTraces(QueryRequest.builder().limit(10000).build())) {
days.add(midnightUTC(guessTimestamp(MergeById.apply(trace).get(0)) / 1000));
}
for (long day : days) {
CassandraDependenciesJob.builder()
.keyspace(storage.keyspace)
.localDc(storage().localDc)
.contactPoints(storage.contactPoints())
.day(day).build().run();
}
}
示例3: processDependencies
import zipkin.storage.QueryRequest; //导入依赖的package包/类
/**
* This processes the job as if it were a batch. For each day we had traces, run the job again.
*/
@Override public void processDependencies(List<Span> spans) {
try {
esStorage().spanConsumer().accept(V2SpanConverter.fromSpans(spans)).execute();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Set<Long> days = new LinkedHashSet<>();
for (List<Span> trace : storage().spanStore()
.getTraces(QueryRequest.builder().limit(10000).build())) {
days.add(midnightUTC(guessTimestamp(MergeById.apply(trace).get(0)) / 1000));
}
for (long day : days) {
ElasticsearchDependenciesJob.builder().index(INDEX).hosts(esNodes()).day(day).build().run();
}
}
示例4: processDependencies
import zipkin.storage.QueryRequest; //导入依赖的package包/类
/**
* This processes the job as if it were a batch. For each day we had traces, run the job again.
*/
@Override
public void processDependencies(List<Span> spans) {
CallbackCaptor<Void> callback = new CallbackCaptor<>();
storage.asyncSpanConsumer().accept(spans, callback);
callback.get();
Set<Long> days = new LinkedHashSet<>();
for (List<Span> trace : storage.spanStore()
.getTraces(QueryRequest.builder().limit(10000).build())) {
days.add(midnightUTC(guessTimestamp(MergeById.apply(trace).get(0)) / 1000));
}
for (long day : days) {
MySQLDependenciesJob.builder().day(day).build().run();
}
}
示例5: getTraces
import zipkin.storage.QueryRequest; //导入依赖的package包/类
@Override
public List<List<Span>> getTraces(QueryRequest request) {
if (tracer.startNewSpan(component, "get-traces") != null) {
tracer.submitBinaryAnnotation("request", request.toString());
}
try {
return delegate.getTraces(request);
} finally {
tracer.finishSpan();
}
}
示例6: overFetchesToCompensateForDuplicateIndexData
import zipkin.storage.QueryRequest; //导入依赖的package包/类
@Test
public void overFetchesToCompensateForDuplicateIndexData() {
int traceCount = 100;
List<Span> spans = new ArrayList<>();
for (int i = 0; i < traceCount; i++) {
final long delta = i * 1000; // all timestamps happen a millisecond later
for (Span s : TestObjects.TRACE) {
spans.add(TestObjects.TRACE.get(0).toBuilder()
.traceId(s.traceId + i * 10)
.id(s.id + i * 10)
.timestamp(s.timestamp + delta)
.annotations(s.annotations.stream()
.map(a -> Annotation.create(a.timestamp + delta, a.value, a.endpoint))
.collect(toList()))
.build());
}
}
accept(spans.toArray(new Span[spans.size()]));
// Index ends up containing more rows than services * trace count, and cannot be de-duped
// in a server-side query.
assertThat(rowCount(Schema.TABLE_TRACE_BY_SERVICE_SPAN))
.isGreaterThan(traceCount * store().getServiceNames().size());
// Implementation over-fetches on the index to allow the user to receive unsurprising results.
assertThat(
store().getTraces(QueryRequest.builder().lookback(86400000L).limit(traceCount).build()))
.hasSize(traceCount);
}
示例7: annotationKeys_serviceNameRequired
import zipkin.storage.QueryRequest; //导入依赖的package包/类
@Test
public void annotationKeys_serviceNameRequired() {
thrown.expect(IllegalArgumentException.class);
CassandraUtil.annotationKeys(
QueryRequest.builder().lookback(86400000L).addAnnotation("sr").build());
}
示例8: annotationKeys
import zipkin.storage.QueryRequest; //导入依赖的package包/类
@Test
public void annotationKeys() {
assertThat(CassandraUtil.annotationKeys(QueryRequest.builder()
.lookback(86400000L)
.serviceName("service")
.addAnnotation(Constants.ERROR)
.addBinaryAnnotation(TraceKeys.HTTP_METHOD, "GET").build()))
.containsExactly("service:error", "service;http.method;GET");
}
示例9: annotationKeys_dedupes
import zipkin.storage.QueryRequest; //导入依赖的package包/类
@Test
public void annotationKeys_dedupes() {
assertThat(CassandraUtil.annotationKeys(QueryRequest.builder()
.lookback(86400000L)
.serviceName("service")
.addAnnotation(Constants.ERROR)
.addAnnotation(Constants.ERROR).build()))
.containsExactly("service:error");
}
示例10: overFetchesToCompensateForDuplicateIndexData
import zipkin.storage.QueryRequest; //导入依赖的package包/类
@Test
public void overFetchesToCompensateForDuplicateIndexData() {
int traceCount = 100;
List<Span> spans = new ArrayList<>();
for (int i = 0; i < traceCount; i++) {
final long delta = i * 1000; // all timestamps happen a millisecond later
for (Span s : TestObjects.TRACE) {
spans.add(TestObjects.TRACE.get(0).toBuilder()
.traceId(s.traceId + i * 10)
.id(s.id + i * 10)
.timestamp(s.timestamp + delta)
.annotations(s.annotations.stream()
.map(a -> Annotation.create(a.timestamp + delta, a.value, a.endpoint))
.collect(toList()))
.build());
}
}
accept(spans.toArray(new Span[0]));
// Index ends up containing more rows than services * trace count, and cannot be de-duped
// in a server-side query.
assertThat(rowCount(Tables.SERVICE_NAME_INDEX))
.isGreaterThan(traceCount * store().getServiceNames().size());
// Implementation over-fetches on the index to allow the user to receive unsurprising results.
assertThat(store().getTraces(QueryRequest.builder().limit(traceCount).build()))
.hasSize(traceCount);
}
示例11: annotationKeys
import zipkin.storage.QueryRequest; //导入依赖的package包/类
@Test
public void annotationKeys() {
assertThat(CassandraUtil.annotationKeys(QueryRequest.builder()
.serviceName("service")
.addAnnotation(Constants.ERROR)
.addBinaryAnnotation(TraceKeys.HTTP_METHOD, "GET").build()))
.containsExactly("service:error", "service:http.method:GET");
}
示例12: annotationKeys_dedupes
import zipkin.storage.QueryRequest; //导入依赖的package包/类
@Test
public void annotationKeys_dedupes() {
assertThat(CassandraUtil.annotationKeys(QueryRequest.builder()
.serviceName("service")
.addAnnotation(Constants.ERROR)
.addAnnotation(Constants.ERROR).build()))
.containsExactly("service:error");
}
示例13: toQueryRequest
import zipkin.storage.QueryRequest; //导入依赖的package包/类
static QueryRequest toQueryRequest(HttpUrl url) {
return QueryRequest.builder().serviceName(url.queryParameter("serviceName"))
.spanName(url.queryParameter("spanName"))
.parseAnnotationQuery(url.queryParameter("annotationQuery"))
.minDuration(maybeLong(url.queryParameter("minDuration")))
.maxDuration(maybeLong(url.queryParameter("maxDuration")))
.endTs(maybeLong(url.queryParameter("endTs")))
.lookback(maybeLong(url.queryParameter("lookback")))
.limit(maybeInteger(url.queryParameter("limit"))).build();
}
示例14: getTraces
import zipkin.storage.QueryRequest; //导入依赖的package包/类
@Override
public List<List<Span>> getTraces(QueryRequest request) {
HttpUrl.Builder url = baseUrl.newBuilder("/api/v1/traces");
maybeAddQueryParam(url, "serviceName", request.serviceName);
maybeAddQueryParam(url, "spanName", request.spanName);
maybeAddQueryParam(url, "annotationQuery", request.toAnnotationQuery());
maybeAddQueryParam(url, "minDuration", request.minDuration);
maybeAddQueryParam(url, "maxDuration", request.maxDuration);
maybeAddQueryParam(url, "endTs", request.endTs);
maybeAddQueryParam(url, "lookback", request.lookback);
maybeAddQueryParam(url, "limit", request.limit);
Response response = call(new Request.Builder().url(url.build()).build());
return Codec.JSON.readTraces(responseBytes(response));
}
示例15: toQueryRequest
import zipkin.storage.QueryRequest; //导入依赖的package包/类
@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);
}