From b0fd8c8dee723c47e2b4c8b4fabc8f0f72c808d3 Mon Sep 17 00:00:00 2001 From: Armen Zambrano G <44410+armenzg@users.noreply.github.com> Date: Fri, 2 May 2025 12:52:23 -0400 Subject: [PATCH] chore(sentry_sdk): Include full stack for captured errors This makes use of the Sentry SDK option added here: https://github.com/getsentry/sentry-python/pull/3673 --- src/sentry/conf/types/sdk_config.py | 2 +- src/sentry/options/defaults.py | 7 +++++++ src/sentry/utils/sdk.py | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sentry/conf/types/sdk_config.py b/src/sentry/conf/types/sdk_config.py index 408a499d59aa79..3a3030cf741006 100644 --- a/src/sentry/conf/types/sdk_config.py +++ b/src/sentry/conf/types/sdk_config.py @@ -16,7 +16,7 @@ class SdkConfig(TypedDict): auto_enabling_integrations: bool keep_alive: NotRequired[bool] spotlight: NotRequired[str | bool | None] - + add_full_stack: NotRequired[bool] send_client_reports: NotRequired[bool] traces_sampler: NotRequired[Callable[[dict[str, Any]], float]] before_send: NotRequired[Callable[[Event, Hint], Event | None]] diff --git a/src/sentry/options/defaults.py b/src/sentry/options/defaults.py index 6886d26f9d53af..ea479c50774739 100644 --- a/src/sentry/options/defaults.py +++ b/src/sentry/options/defaults.py @@ -2356,6 +2356,13 @@ # END: SDK Crash Detection +# Whether to add the full stack trace to Python errors. +register( + "sentry_sdk.add_full_stack", + default=False, + flags=FLAG_AUTOMATOR_MODIFIABLE, +) + register( # Lists the shared resource ids we want to account usage for. "shared_resources_accounting_enabled", diff --git a/src/sentry/utils/sdk.py b/src/sentry/utils/sdk.py index 5a26491c76923a..278cffd88af1f9 100644 --- a/src/sentry/utils/sdk.py +++ b/src/sentry/utils/sdk.py @@ -296,6 +296,7 @@ def _get_sdk_options() -> tuple[SdkConfig, Dsns]: before_send_log=before_send_log, enable_logs=True, ) + sdk_options["add_full_stack"] = options.get("sentry_sdk.add_full_stack", False) # Modify SENTRY_SDK_CONFIG in your deployment scripts to specify your desired DSN dsns = Dsns(