-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(auto_source): Use consistent stack trace granularity #101432
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,8 +90,6 @@ def test_java_raises_exception( | |
| with pytest.raises(expected_exception): | ||
| create_frame_info(frame, "java") | ||
|
|
||
| # Only necessary while auto_source_code_config.multi_module_java is used | ||
| @pytest.mark.django_db | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We added this in the previous PR since we add to check |
||
| @pytest.mark.parametrize( | ||
armenzg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "frame, expected_stack_root, expected_normalized_path", | ||
| [ | ||
|
|
@@ -119,6 +117,12 @@ def test_java_raises_exception( | |
| "foo/bar/Baz", # The path does not use the abs_path | ||
| id="invalid_abs_path_dollar_sign", | ||
| ), | ||
| pytest.param( | ||
| {"module": "foo.Baz", "abs_path": "foo"}, | ||
| "foo/", # Single-depth stack root | ||
| "foo/Baz", | ||
| id="granularity_1", | ||
| ), | ||
| ], | ||
| ) | ||
| def test_java_valid_frames( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1004,32 +1004,6 @@ def test_categorized_frames_are_not_processed(self) -> None: | |
| expected_new_in_app_stack_trace_rules=["stack.module:android.app.** +app"], | ||
| ) | ||
|
|
||
| def test_multi_module_with_old_granularity(self) -> None: | ||
| java_module_prefix = "com.example.multi" | ||
| module_prefix = java_module_prefix.replace(".", "/") + "/" | ||
| repo_trees = { | ||
| REPO1: [ | ||
| f"modules/modX/{module_prefix}foo/Bar.kt", | ||
| f"modules/modY/{module_prefix}bar/Baz.kt", | ||
| ] | ||
| } | ||
| frames = [ | ||
| self.frame_from_module(f"{java_module_prefix}.foo.Bar", "Bar.kt"), | ||
| self.frame_from_module(f"{java_module_prefix}.bar.Baz", "Baz.kt"), | ||
| ] | ||
| self._process_and_assert_configuration_changes( | ||
| repo_trees=repo_trees, | ||
| frames=frames, | ||
| platform=self.platform, | ||
| expected_new_code_mappings=[ | ||
| # It's missing the extra granularity | ||
| # It's going to pick modY since it is the first frame processed, thus, | ||
| # the other frame will not have a working code mapping | ||
| self.code_mapping("com/example/multi/", "modules/modY/com/example/multi/") | ||
| ], | ||
| expected_new_in_app_stack_trace_rules=["stack.module:com.example.** +app"], | ||
| ) | ||
|
|
||
| def test_multi_module(self) -> None: | ||
| # Some Java projects have all modules under the same com/foo/bar directory | ||
| # however, some projects have different modules under different directories | ||
|
|
@@ -1051,16 +1025,13 @@ def test_multi_module(self) -> None: | |
| self.frame_from_module(f"{java_module_prefix}.foo.Bar", "Bar.kt"), | ||
| self.frame_from_module(f"{java_module_prefix}.bar.Baz", "Baz.kt"), | ||
| ] | ||
| with self.options({"auto_source_code_config.multi_module_java": True}): | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just removing the option and left indenting. |
||
| self._process_and_assert_configuration_changes( | ||
| repo_trees=repo_trees, | ||
| frames=frames, | ||
| platform=self.platform, | ||
| expected_new_code_mappings=[ | ||
| self.code_mapping(f"{module_prefix}foo/", f"modules/modX/{module_prefix}foo/"), | ||
| self.code_mapping(f"{module_prefix}bar/", f"modules/modY/{module_prefix}bar/"), | ||
| ], | ||
| expected_new_in_app_stack_trace_rules=[ | ||
| f"stack.module:{java_module_prefix}.** +app" | ||
| ], | ||
| ) | ||
| self._process_and_assert_configuration_changes( | ||
| repo_trees=repo_trees, | ||
| frames=frames, | ||
| platform=self.platform, | ||
| expected_new_code_mappings=[ | ||
| self.code_mapping(f"{module_prefix}foo/", f"modules/modX/{module_prefix}foo/"), | ||
| self.code_mapping(f"{module_prefix}bar/", f"modules/modY/{module_prefix}bar/"), | ||
| ], | ||
| expected_new_in_app_stack_trace_rules=[f"stack.module:{java_module_prefix}.** +app"], | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All cases inside of this if/clause will use
STACK_ROOT_MAX_LEVELrather thanSTACK_ROOT_MAX_LEVEL - 1in some cases.This will create a lot more code mappings (storage cost) but it will make everything more consistent an easier to debug (human cost & quality).
We're already incurring this cost since this morning when I enabled the option. I'm just making it clearer in the code.