-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[GraphQL/Limits] Reimplement QueryLimitsChecker #18666
Merged
Merged
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
amnn
requested review from
wlmyng,
stefan-mysten,
emmazzz and
suiwombat
as code owners
July 15, 2024 11:52
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
stefan-mysten
approved these changes
Jul 15, 2024
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.
Looks good, thanks!
## Description Rewriting query limits checker to land a number of improvements and fixes: - Avoid issues with overflows by counting down from a predefined budget, rather than counting up to the limit and protecting multiplications using `checked_mul`. - Improve detection of paginated fields: Previously we treated all connections-related fields as appearing as many times as the page size (including the field that introduced the connection, and the `pageInfo` field). This was over-approximated the output size by a large margin. The new approach counts exactly the number of nodes in the output: The connection's root field, and any non-`edges` or `nodes` field will not get multiplied by the page size. - Tighter `__schema` query detection: Previously we would skip requests that started with a `__schema` introspection query. Now it's required to be the only operation in the request (not just the first). - Fix metrics collection after limits are hit: Previously, if a limit was hit, we would not observe validation-related metrics in prometheus. Now we will always record such metrics, and if a limit has been hit, it will register as being "at" the limit. ## Test plan ``` sui-graphql-e2e-tests$ cargo nextest run --features pg_integration -- limits/ ```
amnn
added a commit
that referenced
this pull request
Jul 16, 2024
## Description Rewriting query limits checker to land a number of improvements and fixes: - Avoid issues with overflows by counting down from a predefined budget, rather than counting up to the limit and protecting multiplications using `checked_mul`. - Improve detection of paginated fields: - Previously we treated all connections-related fields as appearing as many times as the page size (including the field that introduced the connection, and the `pageInfo` field). This was over-approximated the output size by a large margin. The new approach counts exactly the number of nodes in the output: The connection's root field, and any non-`edges` or `nodes` field will not get multiplied by the page size. - The checker now also detects connections-related fields even if they are obscured by fragment or inline fragment spreads. - Tighter `__schema` query detection: Previously we would skip requests that started with a `__schema` introspection query. Now it's required to be the only operation in the request (not just the first). - Fix metrics collection after limits are hit: Previously, if a limit was hit, we would not observe validation-related metrics in prometheus. Now we will always record such metrics, and if a limit has been hit, it will register as being "at" the limit. ## Test plan ``` sui-graphql-e2e-tests$ cargo nextest run --features pg_integration -- limits/ ``` ## Stack - #18660 - #18661 - #18662 - #18663 - #18664 --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [x] GraphQL: Output node estimation has been made more accurate -- the estimate should now track the theoretical max number of nodes on the JSON `data` output. - [ ] CLI: - [ ] Rust SDK:
tx-tomcat
pushed a commit
to tx-tomcat/sui-network
that referenced
this pull request
Jul 29, 2024
## Description Rewriting query limits checker to land a number of improvements and fixes: - Avoid issues with overflows by counting down from a predefined budget, rather than counting up to the limit and protecting multiplications using `checked_mul`. - Improve detection of paginated fields: - Previously we treated all connections-related fields as appearing as many times as the page size (including the field that introduced the connection, and the `pageInfo` field). This was over-approximated the output size by a large margin. The new approach counts exactly the number of nodes in the output: The connection's root field, and any non-`edges` or `nodes` field will not get multiplied by the page size. - The checker now also detects connections-related fields even if they are obscured by fragment or inline fragment spreads. - Tighter `__schema` query detection: Previously we would skip requests that started with a `__schema` introspection query. Now it's required to be the only operation in the request (not just the first). - Fix metrics collection after limits are hit: Previously, if a limit was hit, we would not observe validation-related metrics in prometheus. Now we will always record such metrics, and if a limit has been hit, it will register as being "at" the limit. ## Test plan ``` sui-graphql-e2e-tests$ cargo nextest run --features pg_integration -- limits/ ``` ## Stack - MystenLabs#18660 - MystenLabs#18661 - MystenLabs#18662 - MystenLabs#18663 - MystenLabs#18664 --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [x] GraphQL: Output node estimation has been made more accurate -- the estimate should now track the theoretical max number of nodes on the JSON `data` output. - [ ] CLI: - [ ] Rust SDK:
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.
Description
Rewriting query limits checker to land a number of improvements and fixes:
Avoid issues with overflows by counting down from a predefined budget, rather than counting up to the limit and protecting multiplications using
checked_mul
.Improve detection of paginated fields:
pageInfo
field). This was over-approximated the output size by a large margin. The new approach counts exactly the number of nodes in the output: The connection's root field, and any non-edges
ornodes
field will not get multiplied by the page size.Tighter
__schema
query detection: Previously we would skip requests that started with a__schema
introspection query. Now it's required to be the only operation in the request (not just the first).Fix metrics collection after limits are hit: Previously, if a limit was hit, we would not observe validation-related metrics in prometheus. Now we will always record such metrics, and if a limit has been hit, it will register as being "at" the limit.
Test plan
Stack
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.
data
output.