-
Notifications
You must be signed in to change notification settings - Fork 245
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
Ensure subgraph requests have access to their corresponding ExecutableDocuments #5016
base: dev
Are you sure you want to change the base?
Conversation
@tninesling, please consider creating a changeset entry in |
CI performance tests
|
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.
Let's add some tests for the new code in the demand control plugin.
.as_parsed(schema) | ||
.map_err(DemandControlError::from) | ||
}) | ||
.expect("must have a valid query") |
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.
I think we should convert to an error here rather than using expect. DemandControlError::QueryParseFailure
could be reused, or we could add something else.
When we apply demand control measurements, we want to measure the cost of an operation at several points. We score the overall operation, the query plan, and each subgraph operation. In order to score these operations, we need to use an ExecutableDocument, which is already provided for the top-level operation but not for the subgraph requests.
In order to achieve this, we could store the ExecutableDocument on each subgraph request. However, this defeats the purpose of having the fetch nodes lazily initialize the documents (and breaks a bunch of query planner tests because they are lacking appropriate subgraph schemas in their setup). To avoid having to define subgraph schemas for all these tests and to preserve the lazy initialization setup, I instead embed a reference to the fetch node that is creating the subgraph request, which can trigger the lazy init when it is being executed.
Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.
Exceptions
Note any exceptions here
Notes
Footnotes
It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. ↩
Configuration is an important part of many changes. Where applicable please try to document configuration examples. ↩
Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. ↩