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
Load Tree Debug #45565
Open
gwincr11
wants to merge
19
commits into
rails:main
Choose a base branch
from
gwincr11:cg-load-tree-debug
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Load Tree Debug #45565
+840
−5
Conversation
This file contains 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
gwincr11
force-pushed
the
cg-load-tree-debug
branch
from
July 11, 2022 19:25
3e7445a
to
5c81285
Compare
Motivation: As the first step in building out active record dynamic includes and the new load tree debug view as proposed in rails#45071 we need the load tree to be available. The load tree stores the siblings in order to allow for easy loading of association data to prevent n+1 queries automatically as shown in rails#45701. It also stores other information about the loaded records to allow for easy debugging of the load tree and traversal of the tree. There will be 2 follow up PR's to this, one re-introducing auto loading, or dynamic loading of associations. The second will be to add a debug view of the load tree.
…ater pr around a debugging view that is in progress.
gwincr11
force-pushed
the
cg-load-tree-debug
branch
from
July 11, 2022 19:33
5c81285
to
10426f4
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This builds off the Load Tree PR #45161 which introduced the tree of all the loaded records. I this pr I am adding a debug view that can be used to debug all loaded active record objects and see how they were loaded. Attached is a demo of it in action.
ar.debug.demo.mov
This is very much a starting point and one could imagine adding a lot more information to it, such as the sql query that loaded the record or the sql explain information.
Other Information
This is the first debug view for active record, I am not sure where it should go, how to test it or if this is even how the rail community would want it to work. You can test it out by adding this to you Application controller:
and then this to a view or a layout:
It could also be a better looking interface, I am not sure how css should be brought into something like this and how to avoid fighting with site other stylesheets out there, which is why I left it out, completely open to ideas.