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
Restore caller context at Jetty javaagent invocation boundaries - #20959
Restore captured caller context at Jetty’s request dispatch and content-consumption boundaries instead of proxying application request listeners, providers, or iterators. Scope the change to the Jetty 9.2 javaagent module; library instrumentation remains unchanged.
Context: Capture the full caller context before starting the CLIENT span, including custom values without a caller span. Preserve nested context choices and restore callback-thread context on exceptional exits.
Lifecycle: Keep CLIENT propagation separate from callback execution. Preserve redirect/authentication suppression, completion ordering, and request reuse.
Regression coverage: Exercise ordinary and deferred bodies, chunk success/failure callbacks, response-triggered aborts, object identity, and independently instrumented outgoing work.
Remaining gap: Late offers to an already-failed deferred provider invoke failure callbacks without a request-associated boundary; attribution remains unresolved under the stated constraints.
This PR restores caller context at Jetty 9.2 javaagent request and content-consumption boundaries without replacing application request listeners, providers, or iterators. Library instrumentation remains unchanged.
Changes:
Separates caller-context restoration from CLIENT span propagation and completion.
Adds boundary instrumentation for request dispatch, body consumption, and aborts.
Adds regression coverage for nested callbacks, deferred bodies, protocol followups, and request reuse.
[Testing] The new tests exercise failed requests, but none throws out of a scoped content method: the abort and upload-failure cases invoke failed(...) normally. Please add an installed-agent test where an iterator or chunk callback throws on a producer thread with an unrelated context, and assert that the thread's span/custom values are restored afterward. Exceptional cleanup of the current context and activeCallback frame is a distinct lifecycle guarantee that the existing failure tests do not cover.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Reentrant callbacks, cross-thread restoration, and protocol completion during request reuse warrant final human review across supported Jetty versions.
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
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.
Restore captured caller context at Jetty’s request dispatch and content-consumption boundaries instead of proxying application request listeners, providers, or iterators. Scope the change to the Jetty 9.2 javaagent module; library instrumentation remains unchanged.