flâneur

Span Issues when merging async genrators · open-telemetry/opentelemetry-python · Discussion #3792

github.com · 202 words · saved by 1 readers

I'm having an issue where I am merging async generators. Arbitrarily within the generators, more spans are being created. This can get messy and I would like to create a separate span for each gene...

I did not. Since the SO post was removed, I am going to copy it over here for easy repro My opentelemetry spans are losing their parents when I create them within an async generator that I then merge with another async generator. I believe the problem is that the span created within stream_fn is getting lost as the merged stream swaps between contexts on the event loop while awaiting. Now, I know that I could manually restore the context after awaiting in this scenario, butin my real scenario restoring the context manually at every await would be very clunky and error prone. how can I…

saved by

related reading