Skip to content

Fix RUM injection for Jakarta servlets not extending HttpServlet - #13018

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 7 commits into
masterfrom
dd/fix/rums-6411-rum-jakarta-generic-servlet
Nov 17, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 7 commits into
masterfrom
dd/fix/rums-6411-rum-jakarta-generic-servlet

Conversation

@pawelchcki

@pawelchcki pawelchcki commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

Fixes RUM auto-injection for Jakarta Servlet 5+ applications whose servlets do not extend HttpServlet, including JSF's FacesServlet.

Moves RUM response wrapping into dedicated instrumentation covering all jakarta.servlet.Servlet implementations. This broader matching is installed only when RUM injection is enabled. When RUM injection is disabled, the new instrumentation is disabled and servlet matching stays unchanged. The existing tracing instrumentation keeps its current matching behavior.

Motivation

A customer reported that RUM injection worked on their landing page but was missing from JSF pages, despite those pages returning text/html.

Jakarta RUM wrapping previously depended on HttpServlet.service(). Servlets such as FacesServlet, which implement Servlet directly, bypassed it.

Additional Notes

  • Wrapping stays at Servlet.service(), preserving filter ordering and the existing principal-extraction behavior.
  • RUM uses a separate nesting guard so non-HttpServlet servlets do not interfere with tracing. Nested calls leave buffered output for the owning call to drain.
  • The RUM wrapper is committed on normal and exceptional exits, independently of tracing context, and before tracing extracts the principal. This preserves trailing response content when a servlet leaves its writer open, including pages without </head>.
  • Async redispatch reuses and commits the existing wrapper.
  • The javax.servlet instrumentation is unchanged.

Regression coverage includes generic-servlet injection and content-type handling, complete responses with unclosed writers, nested calls, exception paths, async redispatch, and principal extraction.

Contributor Checklist

Jira ticket: [RUMS-6411]

🤖 Generated with Claude Code (https://claude.com/claude-code)


PR by Bits - View session in Datadog

Comment @DataDog to request changes

The Jakarta RUM response wrapping only matched HttpServlet subclasses, so
servlets implementing jakarta.servlet.Servlet directly, such as JSF's
FacesServlet, never had the RUM SDK injected. Match every Servlet instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: pawelchcki <pawel.chcki@gmail.com>
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

View session in Datadog

Bits Code status: ✅ Done

Comment @DataDog to request changes

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 60.32% (-0.32%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d1361e9 | Docs | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.09 s 13.98 s [-0.1%; +1.7%] (no difference)
startup:insecure-bank:tracing:Agent 12.97 s 12.99 s [-1.0%; +0.7%] (no difference)
startup:petclinic:appsec:Agent 17.15 s 17.01 s [-0.0%; +1.6%] (no difference)
startup:petclinic:iast:Agent 17.04 s 17.01 s [-0.6%; +1.0%] (no difference)
startup:petclinic:profiling:Agent 16.58 s 16.65 s [-1.3%; +0.5%] (no difference)
startup:petclinic:sca:Agent 17.09 s 17.03 s [-0.6%; +1.4%] (no difference)
startup:petclinic:tracing:Agent 16.01 s 16.31 s [-2.8%; -0.8%] (maybe better)

Commit: d1361e97 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

datadog-bits and others added 2 commits October 26, 2026 15:49
Co-authored-by: pawelchcki <pawel.chcki@gmail.com>
The "Enforce Groovy migration" check fails on newly added .groovy files.
Move the fixture to src/testFixtures/java, keeping the same package and
class names so the Tomcat test needs no change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: pawelchcki <pawel.chcki@gmail.com>
@dd-octo-sts dd-octo-sts Bot removed the Bits AI label Oct 28, 2026
@pawelchcki
pawelchcki marked this pull request as ready for review November 13, 2026 17:58
@pawelchcki
pawelchcki requested review from a team as code owners November 13, 2026 17:58
@pawelchcki
pawelchcki requested review from dougqh and ygree and removed request for a team November 13, 2026 17:58
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T18:00:44.514693Z c50175c Draft marked ready
🔒 Security Review ✅ Completed 2026-11-13T18:02:59.558845Z c50175c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot 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.

Bits Code Review: PASS

More details

Static inspection supports the configuration-gated matcher: non-HttpServlet servlets become eligible for RUM wrapping, while RUM-disabled matching retains its previous scope. No concrete regression was established from the broader tracing advice raised in discussion.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit c50175c

When the marker is not found, the injecting writer still buffers the end
of the response when service exits, and only the instrumentation's commit
flushes it. The existing RUM tests close the writer, which commits too, so
they could not detect a missing commit. Cover HttpServlet and non-HttpServlet
servlets, with and without </head>.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: pawelchcki <pawel.chcki@gmail.com>

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot 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.

Bits Code Review: PASS

More details

The separate RUM advice covers direct Servlet implementations and drains buffered responses independently of the HttpServlet-only tracing guard, preserving the tracing scope raised in the human discussion.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit cf4e308

@dd-octo-sts

dd-octo-sts Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Add at least one type, and one component or instrumentation label to the pull request

If you need help, please check our contributing guidelines.

@dd-octo-sts dd-octo-sts Bot added the tag: ai generated Largely based on code generated by an AI or LLM label Nov 17, 2026
@amarziali amarziali added type: bug fix Bug fix comp: rum Realtime User Monitoring labels Nov 17, 2026

@amarziali amarziali 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.

Thanks for the fix. Looks good for platform. You still need the approval of IDM

@ygree ygree 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.

IDM reviewed

@amarziali

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-17 19:25:15 UTC ℹ️ Start processing command /merge


2026-11-17 19:25:26 UTC ℹ️ MergeQueue: Pull request is not mergeable yet

It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.

  • Run /code blockers to see what is blocking it.
  • Run /remove to cancel it.

2026-11-17 21:58:29 UTC ⚠️ MergeQueue: This merge request was unqueued

andrea.marziali@datadoghq.com unqueued this merge request

@amarziali

Copy link
Copy Markdown
Contributor

@dougqh indeed the PR description was outdated thanks for having spotted it. I updated the PR to better reflect the situation and in a less verbose way. I think it's OK now

@amarziali
amarziali enabled auto-merge November 17, 2026 21:09
@amarziali

Copy link
Copy Markdown
Contributor

/code blockers

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-17 21:46:07 UTC ℹ️ Start processing command /code blockers


2026-11-17 21:46:15 UTC

Detected 2 merge blocker(s) to address:

🟠 Pending

  • Merge gate rule reviewers-approval is running: 1 approval missing
    All required reviewers must approve this pull request before it can be merged. Learn more in our FAQ.

    • Needs approval from Team: rum

    Hint: Questions about this check? Reach out in #dx-source-code-management on Slack.

  • Merge gate rule reviewers-approval is running: 1 approval missing
    All required reviewers must approve this pull request before it can be merged. Learn more in our FAQ.

    • Needs approval from Team: rum

    Hint: Questions about this check? Reach out in #dx-source-code-management on Slack.

@amarziali
amarziali requested a review from a team November 17, 2026 21:51

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot 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.

Bits Code Review: PASS

More details

Static review supports the separate RUM nesting guard and response commit path preserving tracing ownership while covering non-HttpServlet implementations. No actionable defect was identified in wrapping, nested calls, async redispatch, or principal extraction.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit c0f4246

@amarziali
amarziali removed the request for review from a team November 17, 2026 21:57
@amarziali

Copy link
Copy Markdown
Contributor

/merge -c

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-17 21:58:23 UTC ℹ️ Start processing command /merge -c

@amarziali
amarziali disabled auto-merge November 17, 2026 21:58
@amarziali

Copy link
Copy Markdown
Contributor

/merge -c

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-17 22:08:38 UTC ℹ️ Start processing command /merge -c

@amarziali
amarziali force-pushed the dd/fix/rums-6411-rum-jakarta-generic-servlet branch from c0f4246 to 0b3780f Compare November 17, 2026 22:11
@amarziali
amarziali force-pushed the dd/fix/rums-6411-rum-jakarta-generic-servlet branch from 0b3780f to d1361e9 Compare November 17, 2026 22:14
@amarziali
amarziali enabled auto-merge November 17, 2026 22:14

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot 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.

Bits Code Review: PASS

More details

Static review found no actionable defect in the servlet wrapping lifecycle, including nested-call ownership, buffered response draining, and async wrapper reuse. Runtime behavior remains unverified.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit d1361e9

@amarziali
amarziali added this pull request to the merge queue Nov 17, 2026
@dd-octo-sts

dd-octo-sts Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-17 22:55:19 UTC ℹ️ Start processing command /merge


2026-11-17 22:55:23 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 1h (p90).


2026-11-17 23:43:01 UTC ℹ️ MergeQueue: This merge request was merged

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 17, 2026
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 013beb4 into master Nov 17, 2026
686 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the dd/fix/rums-6411-rum-jakarta-generic-servlet branch November 17, 2026 23:43
@github-actions github-actions Bot added this to the 1.70.0 milestone Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: rum Realtime User Monitoring tag: ai generated Largely based on code generated by an AI or LLM type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants