File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 66# up top to prevent circular import due to integration import
77DEFAULT_MAX_VALUE_LENGTH = 1024
88
9+ DEFAULT_MAX_STACK_FRAMES = 100
10+ DEFAULT_ADD_FULL_STACK = False
11+
912
1013# Also needs to be at the top to prevent circular import
1114class EndpointType (Enum ):
@@ -550,8 +553,8 @@ def __init__(
550553 cert_file = None , # type: Optional[str]
551554 key_file = None , # type: Optional[str]
552555 custom_repr = None , # type: Optional[Callable[..., Optional[str]]]
553- add_full_stack = False , # type: bool
554- max_stack_frames = 50 , # type: Optional[int]
556+ add_full_stack = DEFAULT_ADD_FULL_STACK , # type: bool
557+ max_stack_frames = DEFAULT_MAX_STACK_FRAMES , # type: Optional[int]
555558 ):
556559 # type: (...) -> None
557560 pass
Original file line number Diff line number Diff line change 2626
2727import sentry_sdk
2828from sentry_sdk ._compat import PY37
29- from sentry_sdk .consts import DEFAULT_MAX_VALUE_LENGTH , EndpointType
29+ from sentry_sdk .consts import (
30+ DEFAULT_ADD_FULL_STACK ,
31+ DEFAULT_MAX_STACK_FRAMES ,
32+ DEFAULT_MAX_VALUE_LENGTH ,
33+ EndpointType ,
34+ )
3035
3136from typing import TYPE_CHECKING
3237
@@ -837,7 +842,9 @@ def single_exception_from_error_tuple(
837842
838843 # Limit the number of frames
839844 max_stack_frames = (
840- client_options .get ("max_stack_frames" ) if client_options else None
845+ client_options .get ("max_stack_frames" , DEFAULT_MAX_STACK_FRAMES )
846+ if client_options
847+ else None
841848 )
842849 if max_stack_frames is not None :
843850 new_frames = new_frames [:max_stack_frames ]
@@ -1179,7 +1186,7 @@ def event_from_exception(
11791186 exc_info = exc_info_from_error (exc_info )
11801187 hint = event_hint_with_exc_info (exc_info )
11811188
1182- if client_options and client_options [ "add_full_stack" ] :
1189+ if client_options and client_options . get ( "add_full_stack" , DEFAULT_ADD_FULL_STACK ) :
11831190 full_stack = get_full_stack ()
11841191 else :
11851192 full_stack = None
You can’t perform that action at this time.
0 commit comments