From 5b9ebd83e37eab4fdcc0ed693dabc9ef84ac11fd Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Thu, 13 Nov 2025 10:32:55 -0800 Subject: [PATCH 1/2] feat(explorer): custom copy and navigation for get_profile_flamegraph tool --- static/app/views/seerExplorer/utils.tsx | 45 +++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/static/app/views/seerExplorer/utils.tsx b/static/app/views/seerExplorer/utils.tsx index 34abc0df41eb89..67a6271c188757 100644 --- a/static/app/views/seerExplorer/utils.tsx +++ b/static/app/views/seerExplorer/utils.tsx @@ -161,6 +161,14 @@ const TOOL_FORMATTERS: Record = { ? `Watching replay ${shortReplayId}...` : `Watched replay ${shortReplayId}`; }, + + get_profile_flamegraph: (args, isLoading) => { + const profileId = args.profile_id || ''; + const shortProfileId = profileId.slice(0, 8); + return isLoading + ? `Sampling profile ${shortProfileId}...` + : `Sampled profile ${shortProfileId}`; + }, }; /** @@ -328,6 +336,43 @@ export function buildToolLinkUrl( pathname: `/organizations/${orgSlug}/replays/${replay_id}/`, }; } + case 'get_profile_flamegraph': { + const {profile_id, project_id, is_continuous, start_ts, end_ts} = toolLink.params; + if (!profile_id || !project_id) { + return null; + } + + // Look up project slug from project_id + const project = projects?.find(p => p.id === String(project_id)); + if (!project) { + return null; + } + + if (is_continuous) { + // Continuous profiles need start/end timestamps as query params + if (!start_ts || !end_ts) { + return null; + } + + // Convert Unix timestamps to ISO date strings + const startDate = new Date(start_ts * 1000).toISOString(); + const endDate = new Date(end_ts * 1000).toISOString(); + + return { + pathname: `/organizations/${orgSlug}/explore/profiling/profile/${project.slug}/`, + query: { + start: startDate, + end: endDate, + profilerId: profile_id, + }, + }; + } + + // Transaction profiles use profile_id in the path + return { + pathname: `/organizations/${orgSlug}/explore/profiling/profile/${project.slug}/${profile_id}/flamegraph/`, + }; + } default: return null; } From 21067e1c6fce647d8b83fb882d1c39d9fcea791a Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Thu, 13 Nov 2025 10:41:51 -0800 Subject: [PATCH 2/2] fix flamegraph suffix --- static/app/views/seerExplorer/utils.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/app/views/seerExplorer/utils.tsx b/static/app/views/seerExplorer/utils.tsx index 67a6271c188757..2ecab49cde85c9 100644 --- a/static/app/views/seerExplorer/utils.tsx +++ b/static/app/views/seerExplorer/utils.tsx @@ -359,7 +359,7 @@ export function buildToolLinkUrl( const endDate = new Date(end_ts * 1000).toISOString(); return { - pathname: `/organizations/${orgSlug}/explore/profiling/profile/${project.slug}/`, + pathname: `/organizations/${orgSlug}/explore/profiling/profile/${project.slug}/flamegraph/`, query: { start: startDate, end: endDate,