Skip to content

Trace Akka HTTP parser-generated error responses - #20919

Draft
trask with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-5139-cloud
Draft

trask with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-5139-cloud

Conversation

Copilot AI commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Akka HTTP rejects malformed requests such as GET /%% HTTP/1.1 before invoking the application handler, bypassing server-span creation. This change traces the generated response without duplicating spans for requests already delivered to the handler.

  • Instrumentation: Identify pre-delivery rejections and record the actual response status through the shared HTTP instrumenter, preserving sampling and response customization without inventing unavailable request attributes.
  • Lifecycle: Restore temporary rejection state on exceptional exits without opening context scopes.
  • Regression coverage: Assert HTTP 400 and exactly one server span using raw sockets on Akka HTTP 10.0 and 10.2; cover ordinary application-generated 400s and entity-stream failures.

Fixes #5139.

@opentelemetry-pr-dashboard

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-10-23 22:18 UTC

Move out of draft to request review.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

Copilot AI and others added 2 commits October 23, 2026 22:34
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with HTTP server span generation for malformed requests Trace Akka HTTP parser-generated error responses Oct 23, 2026
Copilot AI requested a review from trask October 23, 2026 22:47
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI requested a review from trask October 24, 2026 04:33
@trask
trask requested a balanced review from Copilot October 24, 2026 04:34

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

The supplied review evidence supports rejection detection, state cleanup, and focused regression coverage, with no unresolved blocking findings.

No open issues 🎉

What changed in this PR

Addresses #5139 by extending Akka HTTP server instrumentation to trace parser-generated error responses that bypass application handlers, without duplicating spans for requests already delivered.

Changes:

  • Detect pre-handler parsing failures and trace their response status through the shared HTTP instrumenter.
  • Restore temporary rejection state on exceptional exits and reuse response customization.
  • Add regression coverage for malformed requests, application-generated 400s, and entity-stream failures.
File Description
AkkaHttpServerRouteTest.scala Adds application-generated 400 coverage.
AkkaHttpServerInstrumentationTest.scala Verifies malformed requests produce a 400 and one server span.
AbstractHttpServerInstrumentationTest.scala Clarifies the comment explaining unavailable request methods.
MessageStartErrorInstrumentation.java Marks parser-generated request-start errors.
HttpServerControllerInstrumentation.java Intercepts rejection responses and restores temporary state.
AkkaHttpServerInstrumentationModule.java Registers the new instrumentation classes.
AkkaHttpResponseMutator.java Extracts shared response customization.
AkkaHttpParsingErrorSingletons.java Tracks parsing errors and manages response-span creation.
AkkaHttpParsingErrorAttributesGetter.java Extracts response attributes without inventing request details.
AkkaFlowWrapper.java Reuses the shared response customizer.
AkkaHttpServerJavaRouteTest.java Covers malformed targets and entity failures through raw sockets.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Akka HTTP Bad Request 400 is not being traced

3 participants