-
Notifications
You must be signed in to change notification settings - Fork 616
feat(instrumentation-graphql): Add option to put all resolve spans under the same parent span #3085
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(instrumentation-graphql): Add option to put all resolve spans under the same parent span #3085
Conversation
|
@david-luna This is the other change I would like to contribute. I'm open to discussion since this isn't as black-and-white as the bug fix we just merged. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3085 +/- ##
=======================================
Coverage 92.67% 92.67%
=======================================
Files 237 237
Lines 11247 11251 +4
Branches 2334 2336 +2
=======================================
+ Hits 10423 10427 +4
Misses 824 824
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Hmm. This is bothersome. The line missing coverage was subject to a simple refactor ( What's the correct resolution here? Revert refactor, add a test unrelated to the rest of the PR, or ignore? |
Looks like this is just some confusing output from Codecov - it's passing our target of 80%, you you're good :) |
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.
Sorry for taking too long to review. LGTM
cc: @obecny
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.
All good but if we're adding a new config option we should update the README.md file.
|
Good call, thank you! I added the config and description to the existing table in the README. |
|
Thank you for your contribution @nitrofski! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. |
Which problem is this PR solving?
At the moment, GraphQL "resolve" spans (spans generated for each resolver/sub-resolver in a GraphQL request) are generated in a tree structure that reflects the GraphQL resolution tree. This sounds great in theory, but in practice it generates this kind of traces, where child spans start when their parent spans end.
Although it may look fine at a glance, it has issues:
Collapsing a span with child spans in a trace viewer (maybe some of them handle this better?) results in some amount of time seemingly unaccounted for in the root span. E.g.:
Critical path in viewers like Jaeger does not generate properly
Short description of the changes
The solution is to never have a span end before all its child spans have ended. I can imagine two ways to achieve this:
Add an extra layer of spans for the tree structure, and put the "resolve" spans under their tree structure node.
Put all "resolve" spans under the same parent.
This PR implements option 2 for simplicity. This is opt-in behind a
flatResolveSpansconfiguration.I am open to work toward option 1 if preferred.