Skip to content

feat(profiling): Add attachment download control to the flamegraph toolbar#118071

Open
markushi wants to merge 2 commits into
masterfrom
feat/profile-attachments-ui
Open

feat(profiling): Add attachment download control to the flamegraph toolbar#118071
markushi wants to merge 2 commits into
masterfrom
feat/profile-attachments-ui

Conversation

@markushi

@markushi markushi commented Jun 18, 2026

Copy link
Copy Markdown
Member

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-perfetto feature is enabled (perfetto traces will be the first available profile attachments), and only when at least one attachment exists across the visible chunks.

preview

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.

markushi and others added 2 commits June 18, 2026 22:24
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.
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 18, 2026
@markushi

Copy link
Copy Markdown
Member Author

@sentry review

@markushi markushi marked this pull request as ready for review June 19, 2026 06:09
@markushi markushi requested review from a team as code owners June 19, 2026 06:09

@cursor cursor Bot left a comment

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.

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 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);

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.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2773c78. Configure here.

triggerLabel={t('Download')}
triggerProps={{
icon: <IconDownload />,
...(hasAttachmentRole

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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?

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.

2 participants