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 6
6
# up top to prevent circular import due to integration import
7
7
DEFAULT_MAX_VALUE_LENGTH = 1024
8
8
9
+ DEFAULT_MAX_STACK_FRAMES = 100
10
+ DEFAULT_ADD_FULL_STACK = False
11
+
9
12
10
13
# Also needs to be at the top to prevent circular import
11
14
class EndpointType (Enum ):
@@ -550,8 +553,8 @@ def __init__(
550
553
cert_file = None , # type: Optional[str]
551
554
key_file = None , # type: Optional[str]
552
555
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]
555
558
):
556
559
# type: (...) -> None
557
560
pass
Original file line number Diff line number Diff line change 26
26
27
27
import sentry_sdk
28
28
from 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
+ )
30
35
31
36
from typing import TYPE_CHECKING
32
37
@@ -837,7 +842,9 @@ def single_exception_from_error_tuple(
837
842
838
843
# Limit the number of frames
839
844
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
841
848
)
842
849
if max_stack_frames is not None :
843
850
new_frames = new_frames [:max_stack_frames ]
@@ -1179,7 +1186,7 @@ def event_from_exception(
1179
1186
exc_info = exc_info_from_error (exc_info )
1180
1187
hint = event_hint_with_exc_info (exc_info )
1181
1188
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 ) :
1183
1190
full_stack = get_full_stack ()
1184
1191
else :
1185
1192
full_stack = None
You can’t perform that action at this time.
0 commit comments