Skip to content
Open
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
11 changes: 2 additions & 9 deletions static/app/views/insights/agents/components/aiSpanList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
} from 'sentry/views/insights/agents/utils/query';
import type {AITraceSpanNode} from 'sentry/views/insights/agents/utils/types';
import {SpanFields} from 'sentry/views/insights/types';
import {isTransactionNode} from 'sentry/views/performance/newTraceDetails/traceGuards';
import type {EapSpanNode} from 'sentry/views/performance/newTraceDetails/traceModels/traceTreeNode/eapSpanNode';
import type {TransactionNode} from 'sentry/views/performance/newTraceDetails/traceModels/traceTreeNode/transactionNode';

Expand Down Expand Up @@ -266,12 +265,6 @@ function getNodeInfo(node: AITraceSpanNode, colors: readonly string[]) {
color: colors[1],
};

if (isTransactionNode(node)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to look for 'transaction.op' specifically in value, we can use the baseNode.op getter

nodeInfo.title = node.value.transaction || 'Transaction';
nodeInfo.subtitle = node.value['transaction.op'] || '';
return nodeInfo;
}

const op = node.op ?? 'default';
const truncatedOp = op.startsWith('gen_ai.') ? op.slice(7) : op;
nodeInfo.title = truncatedOp;
Expand Down Expand Up @@ -328,10 +321,10 @@ function getNodeInfo(node: AITraceSpanNode, colors: readonly string[]) {
nodeInfo.color = colors[5];
} else if (getIsHandoffSpan({op})) {
nodeInfo.icon = <IconChevron size="md" isDouble direction="right" />;
nodeInfo.subtitle = node.value.description || '';
nodeInfo.subtitle = node.description || '';
nodeInfo.color = colors[4];
} else {
nodeInfo.subtitle = node.value.description || '';
nodeInfo.subtitle = node.description || '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: TransactionNode title and subtitle are swapped after change

Removing the isTransactionNode check and early return causes TransactionNode types that don't match any AI-specific conditions to have their title and subtitle swapped. Previously, TransactionNode displayed the transaction name (e.g., "POST /api/endpoint") as the title and the operation as the subtitle. Now, for these nodes, title is set to truncatedOp (the operation) and subtitle is set to node.description (the transaction name via the TransactionNode.description getter), reversing the original display order.

Fix in Cursor Fix in Web

}

// Override the color and icon if the node has errors
Expand Down
Loading