Skip to content

feat(chunk): Add attachments to profile chunks#92

Draft
markushi wants to merge 1 commit into
mainfrom
feat/raw-profile-support
Draft

feat(chunk): Add attachments to profile chunks#92
markushi wants to merge 1 commit into
mainfrom
feat/raw-profile-support

Conversation

@markushi

Copy link
Copy Markdown
Member

Adds a generic attachments list to profile chunks, exposed through the Python API. Each attachment references a file stored in the object store — e.g. a raw perfetto trace kept alongside the Sentry-processed chunk — with a name, an optional content_type, and a stored_id:

chunk.set_attachments([vroomrs.Attachment("raw_profile", "application/x-perfetto", "aef123345")])
chunk.get_attachments()  # -> list[Attachment]

New Attachment pyclass plus get_attachments / set_attachments on ProfileChunk, with matching .pyi stubs. The references survive compress()decompress_profile_chunk(), i.e. they persist into the stored chunk representation (covered by a test mirroring the sentry writer flow).

Design notes for reviewers:

  • Attachments are sample-v2-only: the getter returns an empty list and the setter is a no-op on legacy Android-format chunks.
  • set_attachments replaces the whole list rather than appending, so it stays idempotent if the processing task retries.
  • This PR also routes android profiles that carry a version through sample-format detection (from_json_vec_and_platform → version-based dispatch), so android sample-v2 chunks are no longer misrouted to the legacy Android format. This is required for android sample-v2 chunks to support attachments at all.

This is the writer/in-process half of the cross-repo feature; the Go read path lives in getsentry/vroom#670 and the kafka message contract in sentry-kafka-schemas. Needs a vroomrs release + pin bump in sentry once it lands.

Add a generic `attachments` list to profile chunks, exposed through the
Python API (`get_attachments` / `set_attachments` and a new `Attachment`
class). Each attachment has a `name`, an optional `content_type`, and a
`stored_id` referencing an object in the object store, e.g. a raw
perfetto trace stored alongside the processed chunk.

Attachments are supported on sample v2 chunks only: the getter returns an
empty list and the setter is a no-op on legacy Android-format chunks.
`set_attachments` replaces the whole list, keeping it idempotent on
consumer retries.

Also route android profiles that carry a version through sample-format
detection, so android sample v2 chunks are no longer misrouted to the
legacy Android format.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant