You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ktor client: HTTP span shows the redirect’s status instead of the final response #6346
Set up a server where /start returns 302 to /fail, and /fail returns 500 after a short delay.
Make a request to /start with a Ktor client that uses SentryKtorClientPlugin (redirects are followed by default), inside a transaction.
Look at the trace in Sentry: the http.client span is ok and much shorter than the request, even though a “HTTP Client Error with status code: 500” event is captured
Repeat with waitForChildren = true on the transaction and call finish() while the request is in flight: the transaction is sent before the 500 comes back.
The span stays open for the whole redirect chain, then gets the final response's status and is passed to beforeSpan once before it's closed.
Actual Result
When a request made with SentryKtorClientPlugin gets redirected, the HTTP span is closed as soon as the redirect comes back, not when the final response arrives.
For a request that goes 302 → 500:
The span is marked ok, even though the request ended with a 500 (the 500 error event is still captured).
The span's duration covers only the redirect response, so it looks much faster than it really was.
beforeSpan is called for every response in the redirect chain. The second call gets a span that’s already closed.
If the transaction waits for its child spans (waitForChildren), it gets sent right after the redirect, before the request is actually done.
Activity
linear-code commentedon Oct 21, 2026
JAVA-786