Skip to content

Commit

Permalink
git subrepo push --remote=git@github.com:sw1136562366/holoinsight.git…
Browse files Browse the repository at this point in the history
… --branch=feat/support_sofatracer1 opensource

subrepo:
  subdir:   "opensource"
  merged:   "f9f7a3270"
upstream:
  origin:   "git@github.com:sw1136562366/holoinsight.git"
  branch:   "feat/support_sofatracer1"
  commit:   "f9f7a3270"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/Homebrew/brew"
  commit:   "4446fe603"
  • Loading branch information
sanhuan.sw committed Jul 21, 2023
1 parent f9f7a32 commit abb0615
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ public TraceBrief queryBasicTraces(final String tenant, String serviceName,
return traceBrief;
}

/**
*
* @param tenant
* @param start
* @param end
* @param traceId
* @param tags
* @return the span list, the front end needs to build a trace tree based on the relationship
* between spanId and parentSpanId
* @throws IOException
*/
@Override
public Trace queryTrace(String tenant, long start, long end, String traceId, List<Tag> tags)
throws IOException {
Expand Down Expand Up @@ -131,6 +142,19 @@ public Trace queryTrace(String tenant, long start, long end, String traceId, Lis
return trace;
}

/**
* First find the root node of the trace tree (there may be multiple root nodes), and then build
* the trace tree from the root node
*
* @param tenant
* @param start
* @param end
* @param traceId
* @param tags
* @return the tree trace structure, the front end only needs to render, no need to build a tree
* relationship
* @throws Exception
*/
@Override
public List<TraceTree> queryTraceTree(String tenant, long start, long end, String traceId,
List<Tag> tags) throws Exception {
Expand Down Expand Up @@ -295,6 +319,13 @@ private void findChildren(List<Span> spans, Span parentSpan, List<Span> children
});
}

/**
* Find all the root nodes of the trace tree. Since sofatracer may report some special spans
* (spanId==parentSpanId), special processing is required
*
* @param spans
* @return
*/
private List<Span> findRoot1(List<Span> spans) {
List<Span> rootSpans = new ArrayList<>();
ListIterator<Span> iterator = spans.listIterator(spans.size());
Expand Down Expand Up @@ -341,6 +372,13 @@ private List<Span> findRoot1(List<Span> spans) {
return rootSpans;
}

/**
* Recursively build a trace tree starting from the root node
*
* @param spans
* @param parentSpan
* @param children
*/
private void findChildren1(List<Span> spans, Span parentSpan, List<TraceTree> children) {
spans.forEach(span -> {
if (span.getParentSpanId().equals(parentSpan.getSpanId())) {
Expand Down

0 comments on commit abb0615

Please sign in to comment.