Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(derived_code_mappings): Simplify FrameFilename #85981

Merged
merged 3 commits into from
Feb 27, 2025

Conversation

armenzg
Copy link
Member

@armenzg armenzg commented Feb 26, 2025

Changes included:

  • Remove some unused properties
  • Unify code that transforms the file path

Changes included:

* Remove some unused properties
* Unify code that transforms the file path
@armenzg armenzg self-assigned this Feb 26, 2025
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 26, 2025
@@ -12,7 +12,7 @@
from sentry.integrations.base import IntegrationFeatures
from sentry.integrations.manager import default_manager as integrations
from sentry.integrations.services.integration import RpcIntegration, integration_service
from sentry.issues.auto_source_code_config.code_mapping import FrameFilename, find_roots
from sentry.issues.auto_source_code_config.code_mapping import FrameInfo, find_roots
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm renaming the class as it does not just hold a modified frame filename.

frame_file_path = frame_file_path.replace("\\", "/")

if frame_file_path[0] == "/" or frame_file_path[0] == "\\":
frame_file_path = frame_file_path[1:]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm moving this block above within the transformations function.
image


self.full_path = frame_file_path
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


self.full_path = frame_file_path
self.extension = get_extension(frame_file_path)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the above.

# windows drive letters can be like C:\ or C:
# so we need to remove the slash if it exists
if frame_file_path[0] == "/":
frame_file_path = frame_file_path[1:]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved within the transformations function.
image

start_at_index = get_straight_path_prefix_end_index(frame_file_path)
self.straight_path_prefix = frame_file_path[:start_at_index]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in use.

if start_at_index == 0:
self.root = frame_file_path.split("/")[0]
self.stack_root = frame_file_path.split("/")[0]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming it to something more meaningful.

self.root = frame_file_path[0:slash_index]
self.stack_root = frame_file_path[0:slash_index]

def transformations(self, frame_file_path: str) -> str:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy pasted unchanged from two blocks in the __init__ function.

@armenzg armenzg requested a review from MichaelSun48 February 26, 2025 20:14
@armenzg armenzg marked this pull request as ready for review February 26, 2025 20:14
@armenzg armenzg requested a review from a team as a code owner February 26, 2025 20:14
@armenzg armenzg merged commit a1b8a35 into master Feb 27, 2025
49 checks passed
@armenzg armenzg deleted the ref/framefilename/armenzg branch February 27, 2025 12:41
Copy link

sentry-io bot commented Feb 27, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ UnsupportedFrameInfo: This path is not supported. /api/0/projects/{organization_id_or_slug}/{proj... View Issue
  • ‼️ UnsupportedFrameInfo: This path is not supported. /api/0/organizations/{organization_id_or_slug}/... View Issue
  • ‼️ ValueError: empty separator /api/0/projects/{organization_id_or_slug}/{proj... View Issue

Did you find this useful? React with a 👍 or 👎

ameliahsu pushed a commit that referenced this pull request Mar 5, 2025
Changes included:

* Remove some unused properties
* Unify code that transforms the file path
@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants