feat(profiling): Add attachment download control to the flamegraph toolbar#118071
feat(profiling): Add attachment download control to the flamegraph toolbar#118071markushi wants to merge 2 commits into
Conversation
Surface profile-chunk attachments (e.g. Perfetto traces) in the continuous flamegraph toolbar, before the Color Coding button. The control lists the attachments for the profiler in view -- resolved over the same time window the flamegraph uses -- and only renders when at least one is available: a single download button for one attachment, a dropdown when several exist across the visible chunks. Listing is unscoped but downloading requires the org's attachments role, so the control is disabled with a tooltip when the viewer lacks it, mirroring event attachments. Gated behind the continuous-profiling-perfetto feature flag. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the single-button special case with a dropdown in all cases, label items by content type with the chunk and file name as a detail, and move the control after the color-coding selector in the flamegraph options menu.
|
@sentry review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2773c78. Configure here.
| const start = typeof location.query.start === 'string' ? location.query.start : null; | ||
| const end = typeof location.query.end === 'string' ? location.query.end : null; | ||
|
|
||
| const enabled = Boolean(project && profilerId && start && end); |
There was a problem hiding this comment.
Query params skip array values
Medium Severity
profilerId, start, and end are read only when location.query values are plain strings. The continuous profile loader uses decodeScalar, which also accepts the first element when a param is a string array. The flamegraph can load while the attachments query stays disabled, so the download control never appears despite attachments in view.
Reviewed by Cursor Bugbot for commit 2773c78. Configure here.
| triggerLabel={t('Download')} | ||
| triggerProps={{ | ||
| icon: <IconDownload />, | ||
| ...(hasAttachmentRole |
There was a problem hiding this comment.
would it be better to check this role in static/app/components/profiling/flamegraph/flamegraphToolbar/flamegraphOptionsMenu.tsx and just hide the button instead of disabling it?


Adds a download control to the profile page that lists the attachments (e.g. a Perfetto system trace) for the profile currently in view and lets the user download them. The control renders only for continuous profiles when the
continuous-profiling-perfettofeature is enabled (perfetto traces will be the first available profile attachments), and only when at least one attachment exists across the visible chunks.Important
This depends on the backend PR #118029 (the chunk-attachments listing endpoint). That PR must be merged and deployed first — frontend and backend are not atomically deployed.