-
Notifications
You must be signed in to change notification settings - Fork 242
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
feat: include query plan object in extensions #2724
feat: include query plan object in extensions #2724
Conversation
👷 Deploy request for apollo-federation-docs pending review.Visit the deploys page to approve it
|
🦋 Changeset detectedLatest commit: 343e3ca The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
I agree that having the plan in it's structured/original form is likely easier/better for a number of use cases, and in fact, this old TODO comment (which should ideally be removed/updated here) suggests this was the plan all along. However, I also think this needs to be behind a new option, not unconditionally shipped alongside the serialized version, because shipping both is unnecessarily wasteful. And while I understand that shipping plans is only an option that is probably only used for debugging/education in the first place, it remains that some users have some large queries for which the plans are fairly large, and the "object" version is going to be even bigger (potentially substantially because the selection sets representation will be a lot less compact), so this might plausibly impact the responsiveness of current existing use cases, and I don't thing that's fair. Another concern I might have is that shipping the plan "raw" object as done here will expose the underlying selection sets as GraphQL-js encodes them, which:
All that to say that, while I do agree the current prettified version is probably not ideal as it forces some pretty custom parsing for any tooling that want to use it, I also feel that a middle ground format where the plan structure is json but the selection sets of fetches are kept as graphql strings, could maybe be a better "default" longer term. And having a transformation between the internal structure and the external format also make it possible to modify the internal structure without breaking the externally exposed format. I do get that this is a bit more work initially obviously but ... That said, a suggestion could maybe be to start by supporting a
|
I have added the changes to allow a |
Thanks for updating the pull request @samuelAndalon! The team will go over it and give you feedback soon. |
https://github.com/apollographql/router/blob/main/apollo-router/src/plugins/expose_query_plan.rs#L79 this is also done in the router -- so, adding some feature parity. |
I don't think parsing separators adds much complexity, and having just one |
Discussed this offline with Trevor, and agreed to move forward with the PR as is, as how the header look like exactly don't matter all that much probably. |
for debugging purposes include the QueryPlan object, the prettified version of the query plan is hard to read and using the actual source will allow speeding up debugging.
additionally, query plan will help us to get the exact query that a subgraph is receiving which will allow us to run a warming up routine during deployments