-
Notifications
You must be signed in to change notification settings - Fork 439
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 option to gqlgen contrib for skipping spans for field resolvers w/o methods #2684
Comments
…ithout methods, addressing issues DataDog#2610 and DataDog#2684
@samsullivan Thanks for reaching out! We'll take a look (cc @rarguelloF @zarirhamza). I'm a bit surprised about the fix created by Devin. Was it guided by you or did it create the PR completely autonomously? |
Interesting, I didn't even notice the Devin AI actions until your comment. I am not involved and would be happy to handwrite something similar w/tests and w/o AI, if it sounds like a reasonable addition... |
@samsullivan It sounds like a reasonable addition. We'll be glad to review it once it's ready. |
I'm having a hard time testing this since I don't see a good way of forcing gqlgen's |
Nevermind; took a fresh look this morning and dug into the |
Followup now that I've implemented #2597 and started using this middleware; also somewhat related to #2610 in that we're both aiming to reduce overly verbose traces from the same contrib package.
Problem: the contrib package for
gqlgen
creates separate spans for each field being resolved, even if it can automatically be inferred by the fields on the struct (instead of requiring a separate function).Consider the following GQL type:
Consider it being mapped to the following Golang type:
In this case, you would need to implement a function to resolve the book's author via the author ID; this is in contrast to the title, which
gqlgen
can determine automatically.Solution: another option, such as
WithSkipFieldsWithoutMethods
, that would skip creating a span downstream of theInterceptField
method here:dd-trace-go/contrib/99designs/gqlgen/tracer.go
Lines 139 to 141 in 3a426ca
It would be checked with
fieldCtx.IsMethod
; I'm happy to contribute and would be able to do it alongside #2610, also.The text was updated successfully, but these errors were encountered: