getsentry / getsentry/sentry-rust
`sentry-tower` possibly finishes transaction too early for streaming bodies
- Dominant language
- Rust
- Stars
- 752
- Forks
- 190
- Avg merge
- 1h 21m
- Merged PRs (30d)
- 5
Description
In `sentry-tower`, `SentryHttpFuture` starts a transaction on first poll, but it finishes the transaction as soon as the inner service future resolves to `Response`.
This can result in arguably wrong span durations when using streaming responses (e.g. using `axum::body::Body::from_stream` in a HTTP handler), as the transaction is ended as soon as the server starts responding.
Instead, the span should probably last for the entire duration of the response, until the body has finished streaming (either due to normal ending of the request of some kind of error along the way).
This is up for discussion, as it should probably be checked what other SDKs/OTEL do when dealing with streaming responses and align with those approaches. So, the current behavior might be correct. But intuitively I think it's wrong.
Also, I don't know if it's possible to implement such a change without relying directly on `axum`, this might not be possible at the `tower` level.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.