async-graphql: Tracing extension doesn't work properly when used with async code
Expected Behavior
Should build correct spans tree
Actual Behavior
Inconsistent span trees, some spans are missing parent.
Donโt think span.with_subscriber(|(id, d)| d.enter(id))
works in multi threaded runtime
Steps to Reproduce the Problem
- Clone this repo https://github.com/ibralu/async-graphql-tracing. Iโve used starwars example with sleep on resolvers
- Start jaeger
docker run -d --name jaeger \
-e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
-p 5775:5775/udp \
-p 6831:6831/udp \
-p 6832:6832/udp \
-p 5778:5778 \
-p 16686:16686 \
-p 14268:14268 \
-p 14250:14250 \
-p 9411:9411 \
jaegertracing/all-in-one:1.22
- Test with query
{
hero(episode: EMPIRE) {
id
name
friends {
id
name
}
appearsIn
}
}
Specifications
- Version: 2.6
- Platform: macOS
- Subsystem: 11.2
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 37 (8 by maintainers)
Commits related to this issue
- Fix tracing extension doesn't work with async code. ##448 — committed to async-graphql/async-graphql by sunli829 3 years ago
- Fix tracing extension doesn't work with async code. ##448 — committed to async-graphql/async-graphql by sunli829 3 years ago
I have implemented a new extension mechanism on the
master
branch, which is better than the previous implementation, and I believe this problem has been completely solved. If you have time, please help me test it, thank you. ๐Good news, I have made a lot of progress! ๐
I made a lot of changes, and now the Tracing extension is finally working great!
I understand the problem you encountered. Because of the lack of the current span,
tracing::{warn,trace,info...}
canโt work at all. I did neglect this problem, thank you for telling me! I will carefully consider how to solve this problem. ๐Hells yes! ^_^
Tested it out with my project. Works exactly as I expect it to, so far. I will keep testing it and will let you know if there are any issues.
I think this issue has been resolved, if you find that it is still incorrect, please feel free to open it.
Released in
v2.6.3