Skip to content

Conversation

@Zylphrex
Copy link
Member

This ensures that we link with the appropriate event id in the trace view and do not show the transaction in the flamechart view if there's no transaction present.

This ensures that we link with the appropriate event id in the trace view and do
not show the transaction in the flamechart view if there's no transaction present.
@Zylphrex Zylphrex requested review from a team as code owners November 24, 2025 20:43
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 24, 2025
Comment on lines +152 to +162
return {eventId: TraceTree.ParentTransaction(node)?.value?.event_id};
}
if (isEAPSpanNode(node)) {
const threadId = node.value.additional_attributes?.['thread.id'] ?? undefined;
return {
eventId: node.value.transaction_id,
tid: typeof threadId === 'string' ? threadId : undefined,
};
}
return {};
}
Copy link

Choose a reason for hiding this comment

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

Bug: getProfileRouteQueryFromNode can return undefined eventId, leading to ?eventId=undefined in URL for regular profiles due to missing dropUndefinedKeys.
Severity: HIGH | Confidence: High

🔍 Detailed Analysis

The getProfileRouteQueryFromNode function can return {eventId: undefined} for regular span nodes or an empty object for unknown node types. When a regular profile is associated with a span node, this {eventId: undefined} is passed to generateProfileFlamechartRouteWithQuery(), which does not use dropUndefinedKeys. This results in a URL parameter like ?eventId=undefined, creating an invalid query parameter instead of omitting it, breaking the intent of not showing the transaction if no transaction is present.

💡 Suggested Fix

Modify generateProfileFlamechartRouteWithQuery to use dropUndefinedKeys on its query object, similar to generateContinuousProfileFlamechartRouteWithQuery, to prevent undefined eventId values from being included in the URL.

🤖 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/performance/newTraceDetails/traceDrawer/tabs/traceProfiles.tsx#L147-L162

Potential issue: The `getProfileRouteQueryFromNode` function can return `{eventId:
undefined}` for regular span nodes or an empty object for unknown node types. When a
regular profile is associated with a span node, this `{eventId: undefined}` is passed to
`generateProfileFlamechartRouteWithQuery()`, which does not use `dropUndefinedKeys`.
This results in a URL parameter like `?eventId=undefined`, creating an invalid query
parameter instead of omitting it, breaking the intent of not showing the transaction if
no transaction is present.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 3294777

Copy link
Member

@roaga roaga left a comment

Choose a reason for hiding this comment

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

don't know this code but makes sense to me

@Zylphrex Zylphrex merged commit 60264a4 into master Nov 25, 2025
49 checks passed
@Zylphrex Zylphrex deleted the txiao/fix/link-event-id-for-profiles branch November 25, 2025 15:08
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.

3 participants