-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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(gatsby): Add tracing for graphql resolvers #23589
Conversation
7e8415d
to
2a8a62e
Compare
I'm really happy with this PR 🎉 Thank you so much! 🌮 Semantically I will defer to @vladar |
if (typeof property === `function`) { | ||
return source[info.fieldName](args, context, info) | ||
} |
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.
We didn't have this before - is there a specific reason for this change or is it just to be closer to default GraphQL resolver?
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.
So default resolver was'nt a default resolver before, but default resolver for some directives (weird, I know). Now that we put this resolver on everything, I wanted to make it behave like graphql-js default one.
resolve: field.resolve | ||
? tracingResolver(field.resolve) | ||
: defaultTracingResolver, |
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.
We have some logic in node-model which tests for presence of the resolver:
gatsby/packages/gatsby/src/schema/node-model.js
Lines 591 to 602 in 73a4b09
if (gqlField.resolve) { | |
innerValue = await resolveField( | |
nodeModel, | |
schemaComposer, | |
schema, | |
node, | |
gqlField, | |
fieldName | |
) | |
} else { | |
innerValue = node[fieldName] | |
} |
Can this change have some effects on it? I am not entirely sure.
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.
No, it should be same (or actually fixed) behaviour.
190a45f
to
dec142c
Compare
8ed9ff1
to
ec3f15c
Compare
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 as far as I can see. Can't wait to use this while profiling :)
@@ -0,0 +1,51 @@ | |||
import { GraphQLSchema } from "graphql" |
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 understand why you'd do it in this PR but it does make reviews more difficult because github fails to pick up on the rename and has no way to manually ask to compare two files. Please next time do TS conversions in a separate PR.
Description
This adds per-resolver tracing to GraphQL Resolvers during build. This also traces runQuery parts like materialization, running and inline tracing.
Documentation
Related Issues