Skip to content

feat: support attaching bytes#1275

Merged
jpnurmi merged 34 commits into
masterfrom
feat/attach-data-buffer
Jun 24, 2025
Merged

feat: support attaching bytes#1275
jpnurmi merged 34 commits into
masterfrom
feat/attach-data-buffer

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Jun 13, 2025

Copy link
Copy Markdown
Collaborator

Q: Should it be called sentry_attach_buffer or sentry_attach_data?
A: sentry_attach_bytes

TODO:

@github-actions

github-actions Bot commented Jun 13, 2025

Copy link
Copy Markdown
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 8775959

@supervacuus

Copy link
Copy Markdown
Collaborator

If we want to stay consistent with other SDKs, bytes is fine since we also use it for the UUID API in a similar manner. data is somewhat unspecific. We use data in the context of user_data for callbacks (but only as parameter specs) and data as the field for transactions and spans (as part of the function names).

@jpnurmi
jpnurmi force-pushed the feat/attach-data-buffer branch from 90f233b to 9e3dd5e Compare June 17, 2025 07:44
Comment thread src/backends/sentry_backend_crashpad.cpp
@jpnurmi jpnurmi changed the title feat: Support attaching in-memory data buffers feat: support attaching bytes Jun 19, 2025
@jpnurmi
jpnurmi marked this pull request as ready for review June 19, 2025 08:22
Comment thread include/sentry.h
Comment thread include/sentry.h
Comment thread src/CMakeLists.txt Outdated

@supervacuus supervacuus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks nice, thanks! A couple of minor points and one thing that is probably just a limit of my imagination.

Comment thread src/backends/sentry_backend_breakpad.cpp Outdated
Comment thread src/path/sentry_path.cpp Outdated
Comment thread src/sentry_attachment.c
Comment thread src/sentry_attachment.c
Comment thread src/sentry_attachment.c Outdated
Comment thread src/sentry_attachment.c

@supervacuus supervacuus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't know if you'd still like to add anything, but from my end, this is ready to be released.

@jpnurmi

jpnurmi commented Jun 24, 2025

Copy link
Copy Markdown
Collaborator Author

I don't have anything else in mind regarding attachments. We should now have everything that was requested. Thanks for your time reviewing yet another big PR.

@jpnurmi
jpnurmi merged commit 9dd7d6c into master Jun 24, 2025
55 of 58 checks passed
@jpnurmi
jpnurmi deleted the feat/attach-data-buffer branch June 24, 2025 14:27
BernhardMarconato pushed a commit to elgatosf/sentry-native that referenced this pull request Apr 21, 2026
* feat: Support attaching bytes

* fix: move to_crashpad_attachment out of extern C

> warning C4190: 'to_crashpad_attachment' has C-linkage specified,
> but returns UDT 'crashpad::Attachment' which is incompatible with C

* fix: lint

* fix: unreachable

* test: integration

* test: rename

* test: attaching bytes to crashpad is supported on win32 and linux

* crashpad: dump byte attachments on disk

* fix: windows

* let crashpad ensure unique file names

* fix sentry__attachment_from_buffer

* clean up unused uuid

* Update external/crashpad

* alternative: ensure unique file in sentry_backend_crashpad

* clean up

* clean up more

* switch to std::filesystem

* fix leaks in backends

* add sentry__attachment_from_path for convenience and to reduce diff

* fix self-review findings

* revert accidental ws changes

* fix attachment_clone

type & content_type are passed separately and content_type is cloned in
sentry__attachments_add()

* unit-testable sentry__path_unique() to back the "-N.tar.gz" claims

* include <string>

* ref: unique paths for byte attachments

* add note about unique file names with crashpad

* add missing null checks for screenshots

* attachment_clone: add missing error handling

* add note and missing test for buffer attachment comparison

* Bump external/crashpad

* Update external/crashpad

* attachment_eq: clarify with a comment

* document behavior regarding duplicate attachments

* sentry__attachments_remove: replace attachment_eq with ptr cmp
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.

2 participants