Repository navigation
Conversation
…ts and response completion (apache#8209)
konlue
force-pushed
the
feat/http-attempt-observations
branch
from
November 1, 2026 07:58
e8734c0 to
ace8097
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of #8199. Fixes #8209.
Problem
The standard HTTP forwarding path makes one or more real transport calls per logical request (CURRENT resubscribes the same publisher; failover executes against another selected target), but a single enclosing observation cannot describe each attempt: headers readiness is not response completion, because the body is consumed later by
NettyClientMessageWriter/WebClientMessageWriter. There is no read-only, opt-in way to observe each actual attempt — including its body — without changing routing, retry eligibility, circuit-breaker policy or response-writing behavior.Change
UpstreamAttemptObservation(plugin-base): read-only facts of one attempt — identity (unique per transport subscription), target address (no query, no credentials), method, reused trace id, headers-ready timing/status, terminal outcome (COMPLETED/ERROR/CANCELLED, recorded exactly once).UpstreamAttemptObserver+UpstreamAttemptObserverHolder: a small opt-in adapter with a no-op default, registered by observability consumers at startup (mirroringMetricsReporter). With no observer registered the transport path performs one volatile read, returns the same publisher and allocates nothing.AbstractHttpClientPlugin/DefaultRetryStrategy: every transport subscription creates its observation lazily at subscription time (CURRENT resubscriptions and failover attempts each get their own identity), reports headers-ready when the response arrives, and finishes on body completion, error or downstream cancellation. Each attempt finishes from its own subscription closure, so an inline failover resend cannot finish or replace the next attempt's record; the exchange attribute only identifies the serving attempt whose body is still streaming.Tests
UpstreamAttemptObservationTestdrives the realNettyHttpClientPluginandWebClientPluginagainst real localHttpServers: success reports started / headers-ready / completed exactly once; a pre-header connection failure finishes with an error and no status; a delayed chunked body does not finish the observation before the body completes; downstream cancellation recordsCANCELLED; an observer that throws cannot fail the request; with no observer registered nothing is reported.ERROR, the retried subscription on the same publisher recordsCOMPLETED, and with the default inline failover resend the initial attempt keeps itsERRORrecord while the standby attempt recordsCOMPLETED. Both attempts reuse the trace id of the logical request.Verification
Checkstyle clean on the touched modules as part of the reactor
validatephase.