ensure current tracing span is passed into streaming html rewrite #2974
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here I'm trying again to fix this.
Problem is: when we emit log-messages from inside the stream, or sentry errors, these don't contain any information from the parent spans. For example on this sentry we can't really see which crate is affected.
The initially obvious solution was #2874, where I use
Span::enterand the guard object.Some reading and testing made me understand where the memory leak was coming from. Generally the guard object coming from
Span::entershould never be held across await-points. Which I did since I was holding onto it for the whole stream.The solution is to use the async-capable alternative, which is annotating the future with
.instrument(span). The newtracing-futuresdependency is needed so we can directly annotate the stream.Additionally I did forget to pass the span info into our
render_in_threadpoolclojures.