Java Code Examples for zipkin2.internal.DependencyLinker#link()

The following examples show how to use zipkin2.internal.DependencyLinker#link() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RowsToDependencyLinks.java    From zipkin-dependencies with Apache License 2.0 6 votes vote down vote up
@Override public Iterable<DependencyLink> call(Iterable<Row> rows) {
  if (logInitializer != null) logInitializer.run();
  Iterator<Iterator<Span>> traces =
      new DependencyLinkSpanIterator.ByTraceId(rows.iterator(), hasTraceIdHigh);

  if (!traces.hasNext()) return Collections.emptyList();

  DependencyLinker linker = new DependencyLinker();
  List<Span> nextTrace = new ArrayList<>();
  while (traces.hasNext()) {
    Iterator<Span> i = traces.next();
    while (i.hasNext()) nextTrace.add(i.next());
    linker.putTrace(nextTrace);
    nextTrace.clear();
  }
  return linker.link();
}
 
Example 2
Source File: TraceIdAndJsonToDependencyLinks.java    From zipkin-dependencies with Apache License 2.0 5 votes vote down vote up
@Override
public Iterable<DependencyLink> call(Iterable<Tuple2<String, String>> traceIdJson) {
  if (logInitializer != null) logInitializer.run();
  List<Span> sameTraceId = new ArrayList<>();
  for (Tuple2<String, String> row : traceIdJson) {
    try {
      decoder.decode(row._2.getBytes(ElasticsearchDependenciesJob.UTF_8), sameTraceId);
    } catch (Exception e) {
      log.warn("Unable to decode span from traces where trace_id=" + row._1, e);
    }
  }
  DependencyLinker linker = new DependencyLinker();
  linker.putTrace(sameTraceId);
  return linker.link();
}