Skip to content

Fix missing instrumentation for vertx 5.1 responses#11840

Open
vandonr wants to merge 5 commits into
masterfrom
vandonr/vertx51
Open

Fix missing instrumentation for vertx 5.1 responses#11840
vandonr wants to merge 5 commits into
masterfrom
vandonr/vertx51

Conversation

@vandonr

@vandonr vandonr commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

follow up on #11655

  • make sure spans are closed on BlockingException
  • instrument endHandler on new moved http/1 & /2 server responses class

Motivation

I think the missing instrumentation on HttpServerResponseImpl is what caused the test to flake with a missing span. Not sure why it's not failing all the time though, maybe a race condition with another callback that finishes the span ?

Additional Notes

This time, the issue was not in the test but in the instrumentation it seems

Contributor Checklist

  • Format the title according to the contribution guidelines
  • Assign the type: and (comp: or inst:) labels in addition to any other useful labels
  • Avoid using close, fix, or any linking keywords when referencing an issue
    Use solves instead, and assign the PR milestone to the issue
  • Update the CODEOWNERS file on source file addition, migration, or deletion
  • Update public documentation with any new configuration flags or behaviors
  • Add your completed PR to the merge queue by commenting /merge. You can also:
    • Customize the commit message associated with the merge with /merge --commit-message "..."
    • Remove your PR from the merge queue with /merge -c
    • Skip all merge queue checks with /merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level (note: the PR still needs to be mergeable, this will only skip the pre-merge build)
    • Get more information in this doc

Jira ticket: [PROJ-IDENT]

@vandonr vandonr requested a review from a team as a code owner July 2, 2026 13:00
@vandonr vandonr requested review from jordan-wong and removed request for a team July 2, 2026 13:00
@vandonr vandonr added type: bug fix Bug fix inst: vertx Eclipse Vert.x instrumentation labels Jul 2, 2026
@dd-octo-sts

dd-octo-sts Bot commented Jul 2, 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ebbd5e1486

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return new VertxServer(verticle(), routerBasePath(), true)
}

def 'test blocking of JSON request body finishes route handler span'() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Replace the new Spock test with JUnit 5

The repo instructions in /workspace/dd-trace-java/AGENTS.md explicitly say not to write new Groovy/Spock tests and to migrate existing Groovy tests to JUnit 5. This adds a new Spock feature method to the Vert.x 5 test suite, so the new regression coverage should be implemented as JUnit 5 coverage instead of extending the deprecated Groovy suite.

Useful? React with 👍 / 👎.

@datadog-datadog-us1-prod

datadog-datadog-us1-prod Bot commented Jul 2, 2026

Copy link
Copy Markdown

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 69.73% (+12.79%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0afee37 | Docs | Datadog PR Page | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🟡 Java Benchmark SLOs — Performance SLO warning (near threshold)

Suite Status
Startup 🟡 warning

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 13.89 s 13.91 s [-0.7%; +0.5%] (no difference)
startup:insecure-bank:tracing:Agent 12.87 s 12.95 s [-1.4%; +0.2%] (no difference)
startup:petclinic:appsec:Agent 17.55 s 17.39 s [+0.2%; +1.6%] (maybe worse)
startup:petclinic:iast:Agent 17.46 s 17.54 s [-1.1%; +0.3%] (no difference)
startup:petclinic:profiling:Agent 17.50 s 17.39 s [-0.6%; +1.9%] (no difference)
startup:petclinic:sca:Agent 17.69 s 17.51 s [+0.2%; +1.9%] (maybe worse)
startup:petclinic:tracing:Agent 16.67 s 16.67 s [-0.9%; +1.0%] (no difference)

Commit: 0afee377 · 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.

@vandonr vandonr changed the title Fix for Vertx flaky test Fix missing instrumentation for vertx 5.1 responses Jul 6, 2026

@Test
void wrapsApplicationEndHandlerOnVertx51Http1Response() throws Exception {
assumeTrue(hasVertx51Http1Response(), "Http1ServerResponse exists only in Vert.x 5.1+");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not a huge fan of this, but also I don't think it's a big enough change that we should create a new folder for 5.1 ?

// AppSec uses BlockingException as control flow after committing a blocking response
// from advice such as WafPublishingBodyHandler and RoutingContextJsonAdvice. Finish
// immediately because that abort path may bypass Vert.x response/routing end callbacks.
finishHandlerSpan(routingContext);

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.

This catch sees BlockingException thrown synchronously on the actual.handle() stack. But WafPublishingBodyHandler - wraps the async bodyHandler, so it throws on a later event-loop turn, after handle() has already returned.

Might be more reliable to finish the span at the block-commit site (WafPublishingBodyHandler) instead of here, so the async body-block path is covered too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

hmm ok. I think there is value in having the fix to instrument the responses in the current release, so that we don't ship with a known bug. I'll take a look at how to better handle the async path in a follow up PR (because the fix is not straightforward I think)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we need ta way to pass the RoutingContext to WafPublishingBodyHandler to be able to finish spans there

@vandonr vandonr added this pull request to the merge queue Jul 7, 2026
@dd-octo-sts

dd-octo-sts Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jul 7, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-07-07 12:54:00 UTC ℹ️ Start processing command /merge


2026-07-07 12:54:06 UTC ℹ️ MergeQueue: pull request added to the queue

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


2026-07-07 14:54:30 UTCMergeQueue: The build pipeline has timeout

The merge request has been interrupted because the build 1358236102403770214 took longer than expected. The current limit for the base branch 'master' is 120 minutes.

@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 7, 2026
@vandonr

vandonr commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jul 7, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-07-07 14:16:37 UTC ℹ️ Start processing command /merge


2026-07-07 14:16:45 UTC ❌ MergeQueue

PR already in the queue with status in_progress

@vandonr

vandonr commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jul 7, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-07-07 15:00:55 UTC ℹ️ Start processing command /merge
Use /merge -c to cancel this operation!


2026-07-07 15:01:00 UTC ℹ️ MergeQueue: pull request added to the queue

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

Use /merge -c to cancel this operation!


⏳ Processing

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

Labels

inst: vertx Eclipse Vert.x instrumentation type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants