Skip to content

feat: Add user attachments support #205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Jul 1, 2025
Merged

feat: Add user attachments support #205

merged 35 commits into from
Jul 1, 2025

Conversation

limbonaut
Copy link
Collaborator

@limbonaut limbonaut commented Jun 19, 2025

Add user attachments support

Copy link
Contributor

github-actions bot commented Jun 19, 2025

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

Generated by 🚫 dangerJS against 1bc3ed1

@limbonaut limbonaut force-pushed the feat/user-attachments branch from b6b46b8 to 4508c99 Compare June 25, 2025 09:09
@limbonaut limbonaut changed the title feat: User attachments feat: Add user attachments support Jun 25, 2025
@limbonaut limbonaut marked this pull request as ready for review June 25, 2025 19:03
@limbonaut
Copy link
Collaborator Author

@sentry review

Copy link

On it! We are reviewing the PR and will provide feedback shortly.

Copy link

PR Description

This pull request introduces user-defined attachment support to the Sentry Godot SDK. The goal is to allow developers to attach arbitrary files or byte data to Sentry events, providing more context for debugging and issue resolution.

Click to see more

Key Technical Changes

The key technical changes include: 1) Creation of a SentryAttachment class in the Godot layer, which can represent either a file path or raw byte data. 2) Implementation of add_attachment and remove_attachment methods in the SentrySDK class to manage attachments. 3) Modifications to the Android and Native SDKs to handle the new attachment types, including methods for adding and removing attachments using the underlying Sentry native libraries or Android plugin. 4) Addition of tests to verify the functionality of the SentryAttachment class.

Architecture Decisions

The architectural decisions involve creating an abstraction (SentryAttachment) to represent attachments in a platform-agnostic way. The InternalSDK interface is extended to include add_attachment and remove_attachment methods, which are then implemented by the Android and Native SDKs. This allows the core Sentry SDK to manage attachments without being tied to platform-specific details. The Native SDK directly uses the Sentry native library for attachment handling, while the Android SDK uses the Android plugin.

Dependencies and Interactions

This change depends on the Godot Engine's file system and data structures (e.g., String, PackedByteArray). It interacts with the Android plugin and the Sentry native library, delegating the actual attachment handling to these components. It also interacts with the ProjectSettings class to resolve Godot virtual paths to absolute file paths.

Risk Considerations

Potential risks include: 1) File access issues if the Godot application does not have the necessary permissions to read the attached files. 2) Performance overhead if large files are attached, especially on mobile platforms. 3) Compatibility issues with older versions of the Sentry native library or Android plugin. 4) Increased event size, potentially leading to higher data usage and Sentry costs. 5) Incorrect content type leading to issues with Sentry displaying the attachment correctly.

Notable Implementation Details

Notable implementation details include: 1) The use of ProjectSettings::get_singleton()->globalize_path to ensure that file paths are correctly resolved, including Godot virtual paths. 2) The lazy reading of file attachments in the Native SDK, where the file is only read when the event is sent to Sentry. 3) The handling of byte-based attachments in both the Android and Native SDKs. 4) The addition of remove_attachment methods to allow developers to remove attachments that are no longer needed.

Copy link
Collaborator

@jpnurmi jpnurmi left a comment

Choose a reason for hiding this comment

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

One open question about sentry-cocoa remains for the future (maybe something we could contribute if necessary?), but everything included in the PR looks good to me. 👍

Special thanks to the bot for helping ironing out the details. 😁

@limbonaut limbonaut merged commit 7756e28 into main Jul 1, 2025
28 checks passed
@limbonaut limbonaut deleted the feat/user-attachments branch July 1, 2025 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support arbitrary attachments
4 participants