From db395469ea83ceccfb4d77c57caebc75ecb23a68 Mon Sep 17 00:00:00 2001 From: Tony Xiao Date: Fri, 21 Nov 2025 15:08:34 -0500 Subject: [PATCH] fix(trace-view): Link list of profiles to right thread We need to fetch the thread id for the span and link to that directly. --- static/app/views/performance/newTraceDetails/index.tsx | 6 +++++- .../newTraceDetails/traceDrawer/tabs/traceProfiles.tsx | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/static/app/views/performance/newTraceDetails/index.tsx b/static/app/views/performance/newTraceDetails/index.tsx index 9705ad095dd8fc..4bf58637ebd592 100644 --- a/static/app/views/performance/newTraceDetails/index.tsx +++ b/static/app/views/performance/newTraceDetails/index.tsx @@ -114,7 +114,11 @@ function TraceViewImpl({traceSlug}: {traceSlug: string}) { const hideTraceWaterfallIfEmpty = (logsData?.length ?? 0) > 0; const meta = useTraceMeta([{traceSlug, timestamp: queryParams.timestamp}]); - const trace = useTrace({traceSlug, timestamp: queryParams.timestamp}); + const trace = useTrace({ + traceSlug, + timestamp: queryParams.timestamp, + additionalAttributes: ['thread.id'], + }); const tree = useTraceTree({traceSlug, trace, replay: null}); useTraceStateAnalytics({ diff --git a/static/app/views/performance/newTraceDetails/traceDrawer/tabs/traceProfiles.tsx b/static/app/views/performance/newTraceDetails/traceDrawer/tabs/traceProfiles.tsx index 65db1867bf76b8..1a6066d029f788 100644 --- a/static/app/views/performance/newTraceDetails/traceDrawer/tabs/traceProfiles.tsx +++ b/static/app/views/performance/newTraceDetails/traceDrawer/tabs/traceProfiles.tsx @@ -65,15 +65,22 @@ export function TraceProfiles({tree}: {tree: TraceTree}) { return null; } + const threadId = isEAPSpanNode(node) + ? (node.value.additional_attributes?.['thread.id'] ?? undefined) + : undefined; + const tid = typeof threadId === 'string' ? threadId : undefined; + const query = isTransactionNode(node) ? { eventId: node.value.event_id, + tid, } : isSpanNode(node) ? { eventId: TraceTree.ParentTransaction(node)?.value?.event_id, + tid, } - : {}; + : {tid}; const link = 'profiler_id' in profile