From 044ce0aba8bb89abcc5d308fc09acc6ade4e7f27 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Wed, 29 Nov 2023 10:20:45 +0100 Subject: [PATCH] Use in app filepath instead of absolute path (#2541) --- sentry_sdk/tracing_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/tracing_utils.py b/sentry_sdk/tracing_utils.py index 1beb48b538..0407b84f47 100644 --- a/sentry_sdk/tracing_utils.py +++ b/sentry_sdk/tracing_utils.py @@ -238,7 +238,8 @@ def add_query_source(hub, span): except Exception: filepath = None if filepath is not None: - span.set_data(SPANDATA.CODE_FILEPATH, frame.f_code.co_filename) + in_app_path = filepath.replace(project_root, "") + span.set_data(SPANDATA.CODE_FILEPATH, in_app_path) try: code_function = frame.f_code.co_name