Skip to content

reorder webflux error capture - #4633

Open
jackshirazi wants to merge 1 commit into
elastic:mainfrom
jackshirazi:fix-4632
Open

jackshirazi wants to merge 1 commit into
elastic:mainfrom
jackshirazi:fix-4632

Conversation

@jackshirazi

Copy link
Copy Markdown
Contributor

fixes #4632

@jackshirazi
jackshirazi requested a review from a team as a code owner November 26, 2026 14:46
Copilot AI balanced review requested due to automatic review settings November 26, 2026 14:46
@github-actions

Copy link
Copy Markdown

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@mergify

mergify Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified for the WebFlux change intended to preserve HTTP context on error events.

No open issues 🎉

What changed in this PR

This PR addresses #4632 by reordering HTTP context population in the Elastic APM Java agent’s WebFlux instrumentation so error events retain request and response details.

Changes:

  • Populate request context before dispatch for non-servlet transactions.
  • Populate response context before capturing completion errors, while preserving servlet-owned transaction handling.
  • Add regression coverage for HTTP context on unmapped 404 errors in sampled and unsampled requests.
File Description
apm-agent-plugins/​apm-spring-webflux/​apm-spring-webflux-spring5/​src/​test/​java/​co/​elastic/​apm/​agent/​springwebflux/​AbstractServerInstrumentationTest.java Verify error sampling state, request method, URL, and response status.
apm-agent-plugins/​apm-spring-webflux/​apm-spring-webflux-spring5/​src/​main/​java/​co/​elastic/​apm/​agent/​springwebflux/​WebfluxHelper.java Populate HTTP context earlier so it is available when errors are captured.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spring WebFlux error events lack url.* and http.* even when the same transaction contains them

2 participants