Skip to content

Commit

Permalink
Process FOLLOW_UP spans in TraceView
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Vargas <[email protected]>
  • Loading branch information
rubenvp8510 committed Feb 22, 2019
1 parent dd4f809 commit 577e1a0
Showing 1 changed file with 27 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,7 @@ export class UnconnectedSpanTreeOffset extends React.PureComponent<SpanTreeOffse
super(props);

this.ancestorIds = [];
let currentSpan: Span = props.span;
while (currentSpan) {
currentSpan = _get(_find(currentSpan.references, { refType: 'CHILD_OF' }), 'span');
if (currentSpan) {
this.ancestorIds.push(currentSpan.spanID);
}
}

this.computeAncestors(props.span);
// Some traces have multiple root-level spans, this connects them all under one guideline and adds the
// necessary padding for the collapse icon on root-level spans.
this.ancestorIds.push('root');
Expand Down Expand Up @@ -104,6 +97,32 @@ export class UnconnectedSpanTreeOffset extends React.PureComponent<SpanTreeOffse
}
};

checkForFollows(span: Span) {
// Could we have more than one follows_from ?
const follows = _get(_find(span.references, { refType: 'FOLLOWS_FROM' }), 'span');
if (follows) {
this.ancestorIds.push(follows.spanID);
this.computeAncestors(follows);
return true;
}
return false;
}

computeAncestors(span: Span) {
let currentSpan: Span = span;
const isFollow = this.checkForFollows(currentSpan);
// Assuming that follows and child_of are excludes.
if (!isFollow) {
while (currentSpan) {
currentSpan = _get(_find(currentSpan.references, { refType: 'CHILD_OF' }), 'span');
if (currentSpan) {
this.ancestorIds.push(currentSpan.spanID);
this.checkForFollows(currentSpan);
}
}
}
}

render() {
const { childrenVisible, onClick, span } = this.props;
const { hasChildren, spanID } = span;
Expand Down

0 comments on commit 577e1a0

Please sign in to comment.