Repository navigation
Expose request elapsedTime to ResponseInterceptor via InvocationContext - #3690
Merged
Merged
Conversation
ResponseHandler.handleResponse already receives the elapsed time of the request but did not pass it into the InvocationContext handed to the ResponseInterceptor chain. Add an elapsedTime field with a public elapsedTime() accessor to InvocationContext and populate it from ResponseHandler; the async path shares the same handler. Constructors are package-private so the change is purely additive for the public API. Fixes OpenFeign#2617 Signed-off-by: Inf1mum <vadimlazuk5@gmail.com>
velo
enabled auto-merge (squash)
November 16, 2026 10:55
velo
approved these changes
Nov 16, 2026
velo
left a comment
Member
There was a problem hiding this comment.
LGTM - adding elapsedTime to InvocationContext via ResponseInterceptor is additive and doesn't change existing behavior.
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.
Summary
ResponseHandler.handleResponsealready receives the elapsed time of the request, but it was not passed into theInvocationContexthanded to theResponseInterceptorchain, so interceptor implementations could not report how long a request took.This PR adds an
elapsedTimefield and a publicelapsedTime()accessor toInvocationContext, populated fromResponseHandler. The async path (AsyncResponseHandler) delegates toResponseHandler, so it is covered by the same change.The change is purely additive for the public API: the new accessor is a new public method, and the touched constructors are package-private, so japicmp binary/source compatibility is unaffected.
Fixes #2617
Verification
Local verification ran on a host with JDK 21 only (no Docker):
mvn -pl core -Pdev test -Dtoolchain.skip=true: the toolchain profile is skipped as intended, and the main sources (including the touched classes) compile successfully. Test compilation cannot run on this host:default-testCompileis pinned to${latest.java.version}(25) and existing core test sources use Java 22+ unnamed-variable syntax, sojavacfrom JDK 21 rejects them. As a result the core test suite did not execute locally.InvocationContext.java,ResponseHandler.java) were compiled withjavac -source 8 -target 8against the core module classpath — clean.Feign.Builderclient against MockWebServer with a capturingResponseInterceptor) was compiled and run on JDK 21 against the rebuilt classes — the interceptor observedelapsedTime(e.g. 33 ms) and the response still decoded correctly.Everything else is deferred to CI on JDK 25: the full core test suite (including the new
FeignTest.responseInterceptorSeesElapsedTimetest), japicmp compatibility gate, license header check (the local run also needed-Dlicense.skip=truebecause the license plugin's jgit scan fails on linked git worktrees), and google-java-format enforcement.