use of zipkin.internal.DependencyLinker in project zipkin by openzipkin.
the class MySQLSpanStore method aggregateDependencies.
List<DependencyLink> aggregateDependencies(long endTs, @Nullable Long lookback, Connection conn) {
endTs = endTs * 1000;
// Lazy fetching the cursor prevents us from buffering the whole dataset in memory.
Cursor<Record> cursor = context.get(conn).selectDistinct(schema.dependencyLinkFields).from(ZIPKIN_SPANS.leftJoin(ZIPKIN_ANNOTATIONS).on(ZIPKIN_SPANS.TRACE_ID.eq(ZIPKIN_ANNOTATIONS.TRACE_ID).and(ZIPKIN_SPANS.ID.eq(ZIPKIN_ANNOTATIONS.SPAN_ID))).and(ZIPKIN_ANNOTATIONS.A_KEY.in(CLIENT_SEND, CLIENT_ADDR, SERVER_RECV, SERVER_ADDR))).where(lookback == null ? ZIPKIN_SPANS.START_TS.lessOrEqual(endTs) : ZIPKIN_SPANS.START_TS.between(endTs - lookback * 1000, endTs)).groupBy(schema.dependencyLinkGroupByFields).fetchLazy();
Iterator<Iterator<DependencyLinkSpan>> traces = new DependencyLinkSpanIterator.ByTraceId(cursor.iterator(), schema.hasTraceIdHigh);
if (!traces.hasNext())
return Collections.emptyList();
DependencyLinker linker = new DependencyLinker();
while (traces.hasNext()) {
linker.putTrace(traces.next());
}
return linker.link();
}
use of zipkin.internal.DependencyLinker in project zipkin by openzipkin.
the class InMemorySpanStore method getDependencies.
@Override
public List<DependencyLink> getDependencies(long endTs, @Nullable Long lookback) {
QueryRequest request = QueryRequest.builder().endTs(endTs).lookback(lookback).limit(Integer.MAX_VALUE).build();
DependencyLinker linksBuilder = new DependencyLinker();
for (Collection<Span> trace : getTraces(request)) {
linksBuilder.putTrace(trace);
}
return linksBuilder.link();
}
Aggregations