-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
Exposing the delegation plan for debugging purposes #6145
base: master
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 7dadd93 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
🚀 Snapshot Release (
|
Package | Version | Info |
---|---|---|
@graphql-tools/delegate |
10.0.10-alpha-20240506163946-7dadd9316f1972bf8b60a304e51d33014b74c0dc |
npm ↗︎ unpkg ↗︎ |
@graphql-tools/stitch |
9.2.8-alpha-20240506163946-7dadd9316f1972bf8b60a304e51d33014b74c0dc |
npm ↗︎ unpkg ↗︎ |
✅ Benchmark Results
|
💻 Website PreviewThe latest changes are available as preview in: https://0a93dcb5.graphql-tools.pages.dev |
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.
Instead of logging to the console, can we (also) maybe provide the plan through graphql's execution result extensions?
@enisdenjo Since Stitching uses the regular executor, I expose the plan with |
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.
If a plan has an ID, it should be stable and not random otherwise the ID is useless.
Perhaps this should also be a cli option instead of an env variable only ? Cli options are easier to discover since they are documented into the help of the cli itself :-) |
d34fb65
to
b8bf584
Compare
Exposing the delegation plan;
When you enable the environment variable,
EXPOSE_DELEGATION_PLAN
, you can see the delegation plan in the console. This can be useful for debugging and understanding how the delegation works.Also you can pass a different logger to it by using
logFnForContext
map from@graphql-tools/delegate
package.You can also add a
contextId
for that specific gateway request by usingcontextIdMap
map from@graphql-tools/delegate
package.If you want to use those information instead of logging, you can get them by using the
context
object like below;The idea of exposing it via the context is to get the information to be used in other other places. Maybe putting it under extensions here;
https://github.com/ardatan/graphql-mesh/pull/6940/files#diff-5e5874cf986f5d1deeda6bec95633e4d1f45d2b59a022fec7e9cfbf878698042R165
You can find a full exposed plan example here below;
https://github.com/ardatan/graphql-tools/pull/6145/files#diff-9fe42f557cff42c58e7076d60567a7b9fce3798fd0c5882148b8e2bb398332df
The structure of each plan is like;