|
8 | 8 | get_error_message, |
9 | 9 | iter_stacks, |
10 | 10 | ) |
11 | | -from sentry_sdk.tracing_utils import _should_be_included |
| 11 | +from sentry_sdk.tracing_utils import _should_be_included, _get_frame_module_abs_path |
12 | 12 | from sentry_sdk.integrations import Integration |
13 | 13 | from sentry_sdk.scope import add_global_event_processor |
14 | 14 |
|
|
20 | 20 | from sentry_sdk._types import Event, Hint |
21 | 21 |
|
22 | 22 |
|
23 | | -def _is_frame_in_app(tb_frame, in_app_include, in_app_exclude, project_root): |
24 | | - # type: (Any, Optional[List[str]], Optional[List[str]], Optional[str]) -> bool |
25 | | - abs_path = tb_frame.tb_frame.f_code.co_filename |
26 | | - namespace = tb_frame.tb_frame.f_globals.get("__name__") |
27 | | - |
| 23 | +def _is_frame_in_app(namespace, abs_path, in_app_include, in_app_exclude, project_root): |
| 24 | + # type: (Any, Optional[str], Optional[List[str]], Optional[List[str]], Optional[str]) -> bool |
28 | 25 | return _should_be_included( |
29 | 26 | is_sentry_sdk_frame=False, |
30 | 27 | namespace=namespace, |
@@ -55,13 +52,18 @@ def _create_exception_fingerprint( |
55 | 52 | frame_count = 0 |
56 | 53 |
|
57 | 54 | for tb_frame in iter_stacks(tb): |
58 | | - if not _is_frame_in_app(tb_frame, in_app_include, in_app_exclude, project_root): |
| 55 | + abs_path = _get_frame_module_abs_path(tb_frame.tb_frame) or "" |
| 56 | + namespace = tb_frame.tb_frame.f_globals.get("__name__") |
| 57 | + |
| 58 | + if not _is_frame_in_app( |
| 59 | + namespace, abs_path, in_app_include, in_app_exclude, project_root |
| 60 | + ): |
59 | 61 | continue |
60 | 62 |
|
61 | | - file_path = tb_frame.tb_frame.f_code.co_filename or "" |
62 | | - file_name = file_path.split("/")[-1] if "/" in file_path else file_path |
| 63 | + file_name = abs_path.split("/")[-1] if "/" in abs_path else abs_path |
63 | 64 | function_name = tb_frame.tb_frame.f_code.co_name or "" |
64 | 65 | line_number = str(tb_frame.tb_lineno) |
| 66 | + |
65 | 67 | frame_fingerprint = "{}:{}:{}".format( |
66 | 68 | file_name, |
67 | 69 | function_name, |
|
0 commit comments