Skip to content
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

feat: Event hooks & configuration via GDScript #60

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

limbonaut
Copy link
Collaborator

@limbonaut limbonaut commented Jan 14, 2025

This PR introduces configuration via GDScript and adds the user-facing event hooks before_send and on_crash, as outlined in https://develop.sentry.dev/sdk/expected-features/#before-send-hook and https://docs.sentry.io/platforms/native/configuration/filtering/.

It introduces a new public API class called SentryConfiguration which users can extend in a script, and assign the script file in options to configure the SDK during initialization. However, due to the way scripting is initialized in the Godot Engine, this comes with a trade-off: a slightly later initialization. If a configuration script is assigned, initialization must be delayed until ScriptServer is ready to load and run the user script.

Resolves #47
Resolves #48

@limbonaut limbonaut added the enhancement New feature or request label Jan 14, 2025
Copy link
Contributor

github-actions bot commented Jan 14, 2025

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

Generated by 🚫 dangerJS against a5267cc

@limbonaut limbonaut changed the title feat: Event hooks feat: Event hooks & configuration via GDScript Jan 22, 2025
Comment on lines -138 to -150
#ifdef NATIVE_SDK
internal_sdk = std::make_shared<NativeSDK>();
#else
// Unsupported platform
sentry::util::print_debug("This is an unsupported platform. Disabling Sentry SDK...");
enabled = false;
#endif
}

if (!enabled) {
sentry::util::print_debug("Sentry SDK is DISABLED! Operations with Sentry SDK will result in no-ops.");
internal_sdk = std::make_shared<DisabledSDK>();
return;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FYI this code moved to _intialize()

@limbonaut limbonaut marked this pull request as ready for review January 23, 2025 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OptionConfiguration - customize options via code User-facing event hooks
1 participant