|
@@ -23,6 +23,7 @@ import {isRootTransaction} from '../traceDetails/utils';
|
|
|
import {
|
|
|
isAutogroupedNode,
|
|
|
isMissingInstrumentationNode,
|
|
|
+ isNoDataNode,
|
|
|
isParentAutogroupedNode,
|
|
|
isRootNode,
|
|
|
isSiblingAutogroupedNode,
|
|
@@ -141,7 +142,8 @@ export declare namespace TraceTree {
|
|
|
| ChildrenAutogroup
|
|
|
| null;
|
|
|
|
|
|
- type NodePath = `${'txn' | 'span' | 'ag' | 'trace' | 'ms' | 'error'}:${string}`;
|
|
|
+ type NodePath =
|
|
|
+ `${'txn' | 'span' | 'ag' | 'trace' | 'ms' | 'error' | 'empty'}:${string}`;
|
|
|
|
|
|
type Metadata = {
|
|
|
event_id: string | undefined;
|
|
@@ -239,6 +241,9 @@ export function makeTraceNodeBarColor(
|
|
|
if (isTraceErrorNode(node)) {
|
|
|
return theme.red300;
|
|
|
}
|
|
|
+ if (isNoDataNode(node)) {
|
|
|
+ return theme.yellow300;
|
|
|
+ }
|
|
|
return pickBarColor('default');
|
|
|
}
|
|
|
|
|
@@ -503,11 +508,19 @@ export class TraceTree {
|
|
|
TraceTreeNode<TraceTree.Span | TraceTree.Transaction>
|
|
|
> = {};
|
|
|
|
|
|
+ // If we've already fetched children, the tree is already assembled
|
|
|
if (parent.spanChildren.length > 0) {
|
|
|
parent.zoomedIn = true;
|
|
|
return parent;
|
|
|
}
|
|
|
|
|
|
+ // If we have no spans, insert an empty node to indicate that there is no data
|
|
|
+ if (!spans.length && !parent.children.length) {
|
|
|
+ parent.zoomedIn = true;
|
|
|
+ parent.spanChildren.push(new NoDataNode(parent));
|
|
|
+ return parent;
|
|
|
+ }
|
|
|
+
|
|
|
if (parentIsSpan) {
|
|
|
if (parent.value && 'span_id' in parent.value) {
|
|
|
lookuptable[parent.value.span_id] = parent as TraceTreeNode<TraceTree.Span>;
|
|
@@ -964,10 +977,7 @@ export class TraceTree {
|
|
|
.then(data => {
|
|
|
node.fetchStatus = 'resolved';
|
|
|
|
|
|
- const spans = data.entries.find(s => s.type === 'spans');
|
|
|
- if (!spans) {
|
|
|
- return data;
|
|
|
- }
|
|
|
+ const spans = data.entries.find(s => s.type === 'spans') ?? {data: []};
|
|
|
|
|
|
// Remove existing entries from the list
|
|
|
const index = this._list.indexOf(node);
|
|
@@ -979,9 +989,7 @@ export class TraceTree {
|
|
|
}
|
|
|
|
|
|
// Api response is not sorted
|
|
|
- if (spans.data) {
|
|
|
- spans.data.sort((a, b) => a.start_timestamp - b.start_timestamp);
|
|
|
- }
|
|
|
+ spans.data.sort((a, b) => a.start_timestamp - b.start_timestamp);
|
|
|
|
|
|
TraceTree.FromSpans(node, data, spans.data, {sdk: data.sdk?.name});
|
|
|
|
|
@@ -1124,8 +1132,12 @@ export class TraceTreeNode<T extends TraceTree.NodeValue> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- cloneDeep(): TraceTreeNode<T> | ParentAutogroupNode | SiblingAutogroupNode {
|
|
|
- let clone: TraceTreeNode<T> | ParentAutogroupNode | SiblingAutogroupNode;
|
|
|
+ cloneDeep():
|
|
|
+ | TraceTreeNode<T>
|
|
|
+ | ParentAutogroupNode
|
|
|
+ | SiblingAutogroupNode
|
|
|
+ | NoDataNode {
|
|
|
+ let clone: TraceTreeNode<T> | ParentAutogroupNode | SiblingAutogroupNode | NoDataNode;
|
|
|
|
|
|
if (isParentAutogroupedNode(this)) {
|
|
|
clone = new ParentAutogroupNode(
|
|
@@ -1139,6 +1151,8 @@ export class TraceTreeNode<T extends TraceTree.NodeValue> {
|
|
|
} else if (isSiblingAutogroupedNode(this)) {
|
|
|
clone = new SiblingAutogroupNode(this.parent, this.value, this.metadata);
|
|
|
clone.groupCount = this.groupCount;
|
|
|
+ } else if (isNoDataNode(this)) {
|
|
|
+ clone = new NoDataNode(this.parent);
|
|
|
} else {
|
|
|
clone = new TraceTreeNode(this.parent, this.value, this.metadata);
|
|
|
}
|
|
@@ -1316,9 +1330,10 @@ export class TraceTreeNode<T extends TraceTree.NodeValue> {
|
|
|
this._children = children;
|
|
|
}
|
|
|
|
|
|
- get spanChildren(): TraceTreeNode<
|
|
|
- TraceTree.Span | TraceTree.MissingInstrumentationSpan
|
|
|
- >[] {
|
|
|
+ get spanChildren(): (
|
|
|
+ | TraceTreeNode<TraceTree.Span | TraceTree.MissingInstrumentationSpan>
|
|
|
+ | NoDataNode
|
|
|
+ )[] {
|
|
|
return this._spanChildren;
|
|
|
}
|
|
|
|
|
@@ -1594,6 +1609,15 @@ export class SiblingAutogroupNode extends TraceTreeNode<TraceTree.SiblingAutogro
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+export class NoDataNode extends TraceTreeNode<null> {
|
|
|
+ constructor(parent: TraceTreeNode<TraceTree.NodeValue> | null) {
|
|
|
+ super(parent, null, {
|
|
|
+ event_id: undefined,
|
|
|
+ project_slug: undefined,
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
function partialTransaction(
|
|
|
partial: Partial<TraceTree.Transaction>
|
|
|
): TraceTree.Transaction {
|
|
@@ -1703,6 +1727,10 @@ function nodeToId(n: TraceTreeNode<TraceTree.NodeValue>): TraceTree.NodePath {
|
|
|
return `error:${n.value.event_id}`;
|
|
|
}
|
|
|
|
|
|
+ if (isNoDataNode(n)) {
|
|
|
+ return `empty:node`;
|
|
|
+ }
|
|
|
+
|
|
|
if (isRootNode(n)) {
|
|
|
throw new Error('A path to root node does not exist as the node is virtual');
|
|
|
}
|
|
@@ -1858,6 +1886,10 @@ function printNode(t: TraceTreeNode<TraceTree.NodeValue>, offset: number): strin
|
|
|
return padding + 'Trace';
|
|
|
}
|
|
|
|
|
|
+ if (isNoDataNode(t)) {
|
|
|
+ return padding + 'No Data';
|
|
|
+ }
|
|
|
+
|
|
|
if (isTraceErrorNode(t)) {
|
|
|
return padding + (t.value.event_id || t.value.level) || 'unknown trace error';
|
|
|
}
|