Skip to content

Commit 9ad77e0

Browse files
committed
refactor
1 parent 4e15ba1 commit 9ad77e0

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

sentry_sdk/integrations/dedupe.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
get_error_message,
99
iter_stacks,
1010
)
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
1212
from sentry_sdk.integrations import Integration
1313
from sentry_sdk.scope import add_global_event_processor
1414

@@ -20,11 +20,8 @@
2020
from sentry_sdk._types import Event, Hint
2121

2222

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
2825
return _should_be_included(
2926
is_sentry_sdk_frame=False,
3027
namespace=namespace,
@@ -55,13 +52,18 @@ def _create_exception_fingerprint(
5552
frame_count = 0
5653

5754
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+
):
5961
continue
6062

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
6364
function_name = tb_frame.tb_frame.f_code.co_name or ""
6465
line_number = str(tb_frame.tb_lineno)
66+
6567
frame_fingerprint = "{}:{}:{}".format(
6668
file_name,
6769
function_name,

0 commit comments

Comments
 (0)