-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Add cost estimation wrapper #1180
Conversation
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 it looks really really nice. Both the directives and the multipliers are much nicer than other solutions I've seen. Great work @paulpdaniels! 👏
(will review tomorrow or thursday, when work gets quieter 😄) |
d51e6ed
to
dd25ca8
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.
This is great 👍
I have some minor comments. What about the remaining TODOs?
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.
Awesome!
* Add cost estimation wrapper
* Add cost estimation wrapper
Adds a simple cost estimation wrapper for computing the effective cost of executing a query and rejecting it if it is too expensive. Different from
maxDepth
ormaxFields
because it supports an arbitrary function to determine the cost of the field. Out of the box it provides a simplecost
directive that can be added to fields or types to specify their overall cost to execute. Note, because it is a "speculative" cost it can't take advantage of the actual return values meaning that it relies on the user to apply the correct multipliers and to determine a good metric for assessing a fields cost.