Skip to content

ref(insights): Replace span.op and span.description with span.name#112788

Open
obostjancic wants to merge 6 commits intomasterfrom
ognjenbostjancic/tet-2070-stop-using-spanop-and-spandescription-as-a-primary-field
Open

ref(insights): Replace span.op and span.description with span.name#112788
obostjancic wants to merge 6 commits intomasterfrom
ognjenbostjancic/tet-2070-stop-using-spanop-and-spandescription-as-a-primary-field

Conversation

@obostjancic
Copy link
Copy Markdown
Member

@obostjancic obostjancic commented Apr 13, 2026

Summary

  • Replace span.op and span.description with span.name as the primary field across agent monitoring, MCP monitoring, and conversations UI
  • Update ConversationApiSpan interface to make span.name required, with span.description and span.op as optional fallbacks
  • Change all span.op:mcp.server query filters to span.name:mcp.server across MCP tables and 11 widget components
  • Update replaceRawSearchKeys from ['span.description', 'span.name'] to ['span.name'] in all three monitoring areas
  • Replace SpanFields.SPAN_DESCRIPTION with SpanFields.NAME in MCP overview table columns and explore URL fields
  • Update tests to use span.name fixtures

… agent/MCP/conversations monitoring

As span.op and span.description are deprecated in favor of span.name,
update all references across the agent monitoring, MCP monitoring, and
conversations UI to use span.name as the primary field.

- Conversations: Update ConversationApiSpan interface to use span.name as
  required field, with span.description and span.op as optional fallbacks.
  Update isGenAiSpan and createNodeFromApiSpan to use span.name.
- Agent monitoring: Update replaceRawSearchKeys and toolsTable explore URL
  fields from span.description to span.name.
- MCP monitoring: Replace all span.op:mcp.server query filters with
  span.name:mcp.server across overview table, sub-tables, and 11 widget
  components. Update SpanFields.SPAN_DESCRIPTION references to
  SpanFields.NAME. Update explore URL fields.
- Tests: Update useConversation.spec.tsx fixtures to use span.name.

https://claude.ai/code/session_01RFw8EcGNBPjDZnwR4DZa3J
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 13, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 13, 2026
…ationTypeFromSpanName

Update the function name and parameter to reflect the migration from
span.op to span.name. Update all callers in trace view, AI trace nodes,
and conversations. Update getIsMCPNode to check value.name instead of
node.op. Add tests for the renamed function.

https://claude.ai/code/session_01RFw8EcGNBPjDZnwR4DZa3J
@obostjancic obostjancic marked this pull request as ready for review April 14, 2026 07:14
@obostjancic obostjancic requested review from a team as code owners April 14, 2026 07:14
Copy link
Copy Markdown
Contributor

@constantinius constantinius left a comment

Choose a reason for hiding this comment

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

The Sentry bot comment seems legit

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Autofix Details

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: MCP overview table shows identical "mcp.server" for all rows
    • Updated SpanNameCell to display unique tool/prompt names and added proper filters to drilldown links to differentiate each row.
  • ✅ Fixed: Function receives node.op instead of span name
    • Changed getGenAiOpType and getAIEnhancedDescription to correctly pass node.value.name instead of node.op to getGenAiOperationTypeFromSpanName.

Create PR

Or push these changes by commenting:

@cursor push 40afe4f06c
Preview (40afe4f06c)
diff --git a/static/app/views/insights/pages/agents/utils/aiTraceNodes.tsx b/static/app/views/insights/pages/agents/utils/aiTraceNodes.tsx
--- a/static/app/views/insights/pages/agents/utils/aiTraceNodes.tsx
+++ b/static/app/views/insights/pages/agents/utils/aiTraceNodes.tsx
@@ -66,7 +66,7 @@
 
   return (
     (attributeObject?.[SpanFields.GEN_AI_OPERATION_TYPE] as string | undefined) ??
-    getGenAiOperationTypeFromSpanName(node.op)
+    getGenAiOperationTypeFromSpanName(node.value.name)
   );
 }
 

diff --git a/static/app/views/insights/pages/mcp/components/mcpOverviewTable.tsx b/static/app/views/insights/pages/mcp/components/mcpOverviewTable.tsx
--- a/static/app/views/insights/pages/mcp/components/mcpOverviewTable.tsx
+++ b/static/app/views/insights/pages/mcp/components/mcpOverviewTable.tsx
@@ -186,6 +186,12 @@
 
   const search = new MutableSearch('');
   search.addFilterValue(SpanFields.NAME, spanName);
+  if (toolName) {
+    search.addFilterValue(SpanFields.MCP_TOOL_NAME, toolName);
+  }
+  if (promptName) {
+    search.addFilterValue(SpanFields.MCP_PROMPT_NAME, promptName);
+  }
   const link = getExploreUrl({
     organization,
     selection,
@@ -200,5 +206,6 @@
     sort: '-count(span.duration)',
     field: fields,
   });
-  return <Link to={link}>{spanName}</Link>;
+  const displayName = toolName || promptName || spanName;
+  return <Link to={link}>{displayName}</Link>;
 }

diff --git a/static/app/views/performance/newTraceDetails/traceRow/traceEAPSpanRow.tsx b/static/app/views/performance/newTraceDetails/traceRow/traceEAPSpanRow.tsx
--- a/static/app/views/performance/newTraceDetails/traceRow/traceEAPSpanRow.tsx
+++ b/static/app/views/performance/newTraceDetails/traceRow/traceEAPSpanRow.tsx
@@ -36,7 +36,7 @@
 
   const opType =
     (attrs[SpanFields.GEN_AI_OPERATION_TYPE] as string | undefined) ??
-    getGenAiOperationTypeFromSpanName(node.op);
+    getGenAiOperationTypeFromSpanName(node.value.name);
 
   if (!opType) {
     return undefined;

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

… overview table

- Pass node.value.name instead of node.op to getGenAiOperationTypeFromSpanName
  in aiTraceNodes.tsx and traceEAPSpanRow.tsx, matching the function's contract
- Revert MCP overview table to use span.description for grouping/display since
  span.name is always 'mcp.server' for all MCP spans, making rows indistinguishable
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1a73039. Configure here.

@gggritso
Copy link
Copy Markdown
Member

🙏🏻 don't forget the files in prebuiltConfigs, LGTM though

Update the MCP prebuilt dashboard filters to use span.name for mcp.server.

This keeps the prebuilt dashboards aligned with the field migration on this branch so the default queries continue to return MCP data.

Refs TET-2070
Co-Authored-By: Codex <noreply@openai.com>
@obostjancic obostjancic requested a review from a team as a code owner April 14, 2026 14:16
@sentry
Copy link
Copy Markdown
Contributor

sentry bot commented Apr 14, 2026

Sentry Snapshot Testing

Name Added Removed Modified Renamed Unchanged Status
sentry-frontend
sentry-frontend
0 0 0 0 204 ✅ Unchanged

Comment on lines +92 to +93
op: apiSpan['span.name'],
description: apiSpan['span.name'],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: Both op and description are set to span.name. If span.name is a human-readable string, it will be incorrectly displayed as the operation type in the UI.
Severity: MEDIUM

Suggested Fix

Restore the previous behavior of using a dedicated field for the operation type, such as span.op, for the op property of the trace node. The description property can continue to use span.name or a more appropriate description field if available. This will ensure the operation type badge displays a technical identifier while the description shows the human-readable name.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location:
static/app/views/insights/pages/conversations/hooks/useConversation.tsx#L92-L93

Potential issue: In `useConversation.tsx`, both the `op` and `description` fields for a
trace node are assigned the value of `apiSpan['span.name']`. Test data confirms that
`span.name` can contain either a technical operation identifier (e.g.,
`'gen_ai.generate'`) or a human-readable name (e.g., `'My AI Agent'`). The UI component
`traceEAPSpanRow.tsx` renders the `op` field directly in a badge intended for operation
types. This will cause human-readable names to be displayed in the operation type badge,
which is semantically incorrect and degrades the trace visualization. The previous
distinction between operation and description is lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants