-
Notifications
You must be signed in to change notification settings - Fork 131
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
Expose query plan #322
Comments
|
Hi @jensneuse thanks for your quick response. Do you have a timeline for (1), and/or estimates for how long (1) and (2) would take? We're happy to work with you on this in whatever way makes sense, but a timeline would help us know if we need to look into workaround in the meanwhile. |
(One thing (2) will require is threading through the service name, since right now that information is not available in any data that the query plan has access to, that I'm aware of. I don't know if you had thoughts on how you'd like to see that done, as well.) |
what do you mean by service name? |
In Apollo, data sources have an identifier (which they call "name"). In the query plan we want to know which data source is responsible for which fields. The data source URL could be used to identify a data source, but it would be more convenient if we could associate an identifier with a data source directly. |
(This is, for example, |
I think we could give each datasouce a name, which could default to an auto generated value. It would be interesting if you could describe the final "outcome" you'd like to achieve. This way, we could work our way backwards. An idea could be that you create a PR with a markdown or other format to describe the desired outcome. We can iterate on this and implement a solution when we're happy. |
From a product standpoint, what we need is something that is functionally equivalent to the apollo query plan; the thing that looks like
It's easiest for us if this is presented using Go data structures, so we don't have to write a parser for it, but even if just the string form were provided it would be good enough. We do need all the information in it though, in particular the "path" and "service" annotations. |
@dnerdy wrote up a proof of concept of what it could look like to pass a "Name" through to the query planner, so it could fill out the
And when creating the datasource, the client could specify the |
I'd be happy to continue driving this forward. @jensneuse do you like the format of the Apollo query plan? A benefit of the format is that it's very similar to an operation document (aside from the I'm not sure what the ideal format would be for other data source types. I'd be happy to start up a doc to continue the conversation, as you suggested. Or, we could toss around ideas in this thread. Either works for me. |
The pretty printed query plans are available on post-processed query plan here
Intermediate query plans could be enabled here
|
We have a use case that requires access to the query plan. We use the query plan for side-by-side testing responses when migrating fields between services.
Would y'all be open to adding a method to the V2 engine to return a simplified version of the query plan?
The returned plan would have its own dedicated types so the internals of the resolve package aren't exposed. If desired, the plan could be wired up to the Query Plan tab of the Apollo-maintained graphql-playground (the playground bundled with graphql-go-tools would need to be updated). That way this feature could benefit all graphql-go-tools users.
For reference, this is what the query plan looks like in the Apollo playground:
And here's a more detailed plan:
The query plan need not match this format exactly. Aside from side-by-side testing, we have found it useful to have readable query plans during development.
Note that the plan string (in the examples above) is formatted like a GraphQL query document, though in Go it would probably make sense to expose a struct like:
Thoughts?
The text was updated successfully, but these errors were encountered: