Skip to content

Commit

Permalink
Process FOLLOWS_FROM spans in TraceView
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
  • Loading branch information
rubenvp8510 committed Feb 25, 2019
1 parent ca0454c commit a60fd50
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import cx from 'classnames';
import _get from 'lodash/get';
import _find from 'lodash/find';
import React from 'react';
import IoChevronRight from 'react-icons/lib/io/chevron-right';
import IoIosArrowDown from 'react-icons/lib/io/ios-arrow-down';
Expand Down Expand Up @@ -54,14 +53,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 @@ -106,6 +98,17 @@ export class UnconnectedSpanTreeOffset extends React.PureComponent<SpanTreeOffse
}
};

computeAncestors(rootSpan: Span) {
let currentSpan: Span = rootSpan;
while (currentSpan && Array.isArray(currentSpan.references) && currentSpan.references.length) {
const { refType, span } = currentSpan.references[0] || {};
if (span && (refType === 'FOLLOWS_FROM' || refType === 'CHILD_OF')) {
this.ancestorIds.push(span.spanID);
currentSpan = span;
}
}
}

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

0 comments on commit a60fd50

Please sign in to comment.