feat(profiling): Add support for profiling chunk attachments#118029
Open
markushi wants to merge 2 commits into
Open
feat(profiling): Add support for profiling chunk attachments#118029markushi wants to merge 2 commits into
markushi wants to merge 2 commits into
Conversation
Contributor
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
Contributor
|
This PR has a migration; here is the generated SQL for for --
-- Create model ProfileChunkAttachment
--
CREATE TABLE "sentry_profilechunkattachment" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "project_id" bigint NOT NULL, "profiler_id" varchar(36) NOT NULL, "chunk_id" varchar(36) NOT NULL, "name" text NOT NULL, "content_type" text NULL, "stored_id" text NOT NULL, "date_added" timestamp with time zone NOT NULL, "date_expires" timestamp with time zone DEFAULT ((STATEMENT_TIMESTAMP() + '30 days 0.000000 seconds'::interval)) NOT NULL);
CREATE UNIQUE INDEX CONCURRENTLY "sentry_profilechunkattach_unique" ON "sentry_profilechunkattachment" ("project_id", "profiler_id", "chunk_id", "stored_id");
ALTER TABLE "sentry_profilechunkattachment" ADD CONSTRAINT "sentry_profilechunkattach_unique" UNIQUE USING INDEX "sentry_profilechunkattach_unique";
CREATE INDEX CONCURRENTLY "sentry_profilechunkattachment_date_expires_11beddd2" ON "sentry_profilechunkattachment" ("date_expires"); |
Member
Author
|
@sentry review |
wmak
approved these changes
Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continuous-profiling chunks can now carry attachments (e.g. Perfetto system traces). Relay stores the attachment blob directly in Objectstore under the
profile_attachmentsusecase (requires getsentry/relay#6108 to merged first) and forwards the resulting key on the profile-chunk Kafka message.This PR persists a lightweight
ProfileChunkAttachmentrow referencing that blob and exposes endpoints to list and download attachments, heavily inspired by the events attachment endpoint.The whole feature is gated behind the new
organizations:continuous-profiling-perfettoflag.The blob itself is owned by Objectstore and reclaimed via its TTL, so we only store metadata plus the
stored_id.date_expiresmirrors the chunk retention and the model is registered for expiry-based cleanup.Two endpoints are added:
GET .../organizations/{org}/profiling/chunk-attachments/lists attachments for a profiler's chunks, including per-attachment metadata. The visible chunks are resolved fromprofiler_idand the time range using the same logic as the flamegraph, so results match what is rendered.GET .../projects/{org}/{project}/profiling/chunks/{profiler_id}/{chunk_id}/attachments/{id}/?downloadstreams the attachment blob. The?downloadquery parameter is required (a request without it returns400), keeping the contract consistent withEventAttachmentDetails. Access requires the organization's configured attachments role, mirroringEventAttachmentDetailsPermission, since traces can contain sensitive data. Per-attachment metadata is served by the list endpoint above, so this endpoint is download-only.