Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion static/app/views/performance/newTraceDetails/trace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ function RenderTraceRow(props: {
: TRACE_CHILDREN_COUNT_WRAPPER_CLASSNAME;

const listColumnStyle: React.CSSProperties = {
paddingLeft: TraceTree.Depth(node) * props.manager.row_depth_padding,
paddingLeft: TraceTree.depth(node) * props.manager.row_depth_padding,
};

const rowProps: TraceRowProps<BaseNode> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('makeExampleTrace', () => {

// Root span + its descendants
expect(tree.list).toHaveLength(22);
expect(Math.max(...tree.list.map(node => TraceTree.Depth(node)))).toBeGreaterThan(1);
expect(Math.max(...tree.list.map(node => TraceTree.depth(node)))).toBeGreaterThan(1);
});

it('makes spans with unique ids so none are dropped as cycles', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -844,11 +844,11 @@ describe('TraceTree', () => {
]);
expect(TraceTree.VisibleParent(childTransactionA)).toBe(rootTransaction);
expect(TraceTree.VisibleParent(childTransactionB)).toBe(rootTransaction);
expect(TraceTree.Depth(childTransactionA)).toBe(
TraceTree.Depth(rootTransaction) + 1
expect(TraceTree.depth(childTransactionA)).toBe(
TraceTree.depth(rootTransaction) + 1
);
expect(TraceTree.Depth(childTransactionB)).toBe(
TraceTree.Depth(rootTransaction) + 1
expect(TraceTree.depth(childTransactionB)).toBe(
TraceTree.depth(rootTransaction) + 1
);
expect(TraceTree.IsLastVisibleChild(childTransactionA)).toBe(false);
expect(TraceTree.IsLastVisibleChild(childTransactionB)).toBe(true);
Expand All @@ -865,8 +865,8 @@ describe('TraceTree', () => {
expect(childTransactionB.parent).toBe(spanB);
expect(TraceTree.VisibleParent(childTransactionA)).toBe(spanA);
expect(TraceTree.VisibleParent(childTransactionB)).toBe(spanB);
expect(TraceTree.Depth(childTransactionA)).toBe(TraceTree.Depth(spanA) + 1);
expect(TraceTree.Depth(childTransactionB)).toBe(TraceTree.Depth(spanB) + 1);
expect(TraceTree.depth(childTransactionA)).toBe(TraceTree.depth(spanA) + 1);
expect(TraceTree.depth(childTransactionB)).toBe(TraceTree.depth(spanB) + 1);
expect(tree.list.slice(rootTransactionIndex, rootTransactionIndex + 5)).toEqual([
rootTransaction,
spanA,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1198,13 +1198,13 @@ export class TraceTree extends TraceTreeEventDispatcher {
* Return a lazily calculated depth of the node in the tree.
* Root node has a value of -1 as it is abstract.
*/
static Depth(node: BaseNode): number {
static depth(node: BaseNode): number {
if (node.depth !== undefined) {
return node.depth;
}

const visibleParent = TraceTree.VisibleParent(node);
node.depth = visibleParent ? TraceTree.Depth(visibleParent) + 1 : 0;
node.depth = visibleParent ? TraceTree.depth(visibleParent) + 1 : 0;
return node.depth;
}

Expand Down Expand Up @@ -1251,12 +1251,12 @@ export class TraceTree extends TraceTreeEventDispatcher {
let start = TraceTree.VisibleParent(node);

if (start?.isRootNodeChild() && !TraceTree.IsLastVisibleChild(node)) {
node.connectors = [-TraceTree.Depth(node)];
node.connectors = [-TraceTree.depth(node)];
return node.connectors;
}

if (!TraceTree.IsLastVisibleChild(node)) {
connectors.push(TraceTree.Depth(node));
connectors.push(TraceTree.depth(node));
}

while (start) {
Expand All @@ -1275,7 +1275,7 @@ export class TraceTree extends TraceTreeEventDispatcher {
}

connectors.push(
visibleParent.isRootNodeChild() ? -TraceTree.Depth(start) : TraceTree.Depth(start)
visibleParent.isRootNodeChild() ? -TraceTree.depth(start) : TraceTree.depth(start)
);
start = visibleParent;
}
Expand Down Expand Up @@ -1513,7 +1513,7 @@ export class TraceTree extends TraceTreeEventDispatcher {

function printTraceTreeNode(node: BaseNode, offset: number): string {
// +1 because we may be printing from the root which is -1 indexed
const padding = ' '.repeat(TraceTree.Depth(node) + offset);
const padding = ' '.repeat(TraceTree.depth(node) + offset);
return padding + node.printNode();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1101,8 +1101,8 @@ export class VirtualizedViewManager {
max = Math.max(max, width);
innerMostNode =
!innerMostNode ||
TraceTree.Depth(this.columns.list.column_nodes[i]!) <
TraceTree.Depth(innerMostNode)
TraceTree.depth(this.columns.list.column_nodes[i]!) <
TraceTree.depth(innerMostNode)
? this.columns.list.column_nodes[i]
: innerMostNode;
}
Expand All @@ -1111,7 +1111,7 @@ export class VirtualizedViewManager {
if (translation + max < 0) {
this.scrollRowIntoViewHorizontally(innerMostNode);
} else if (
translation + TraceTree.Depth(innerMostNode) * this.row_depth_padding >
translation + TraceTree.depth(innerMostNode) * this.row_depth_padding >
this.columns.list.width * this.view.trace_container_physical_space.width
) {
this.scrollRowIntoViewHorizontally(innerMostNode);
Expand All @@ -1129,8 +1129,8 @@ export class VirtualizedViewManager {
const translation = this.columns.list.translate[0];

return (
translation + TraceTree.Depth(node) * this.row_depth_padding < 0 ||
translation + TraceTree.Depth(node) * this.row_depth_padding >
translation + TraceTree.depth(node) * this.row_depth_padding < 0 ||
translation + TraceTree.depth(node) * this.row_depth_padding >
(this.columns.list.width * this.view.trace_container_physical_space.width) / 2
);
}
Expand All @@ -1141,7 +1141,7 @@ export class VirtualizedViewManager {
offset_px = 0,
position: 'exact' | 'measured' = 'measured'
) {
const depth_px = -TraceTree.Depth(node) * this.row_depth_padding + offset_px;
const depth_px = -TraceTree.depth(node) * this.row_depth_padding + offset_px;
const newTransform =
position === 'exact' ? depth_px : this.clampRowTransform(depth_px);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function TraceLoadingRow(props: {
<div
className="TraceLeftColumnInner"
style={{
paddingLeft: TraceTree.Depth(props.node) * props.manager.row_depth_padding,
paddingLeft: TraceTree.depth(props.node) * props.manager.row_depth_padding,
}}
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function TraceRowConnectors(props: {
node: BaseNode;
}) {
const hasChildren = props.node.hasDirectVisibleChildren();
const nodeDepth = TraceTree.Depth(props.node);
const nodeDepth = TraceTree.depth(props.node);

return (
<Fragment>
Expand Down
Loading