Skip to content

Rework DumpHangedTestPlugin to configure only its own project#11846

Open
AlexeyKuznetsov-DD wants to merge 1 commit into
masterfrom
alexeyk/gradle-dump-hanged-pluging-reworked
Open

Rework DumpHangedTestPlugin to configure only its own project#11846
AlexeyKuznetsov-DD wants to merge 1 commit into
masterfrom
alexeyk/gradle-dump-hanged-pluging-reworked

Conversation

@AlexeyKuznetsov-DD

Copy link
Copy Markdown
Contributor

What Does This Do

Reworks DumpHangedTestPlugin so each plugin instance only configures its own project's Test tasks. Fan-out is now done via allprojects { apply(...) } in the root build.gradle.kts instead of the plugin walking project.subprojects(...).

Motivation

The old plugin did cross-project configuration (subprojects(::configure) from the root), a Gradle anti-pattern incompatible with the configuration cache / project isolation.

Additional Notes

Behavior is unchanged: same Test tasks instrumented, single shared DumpSchedulerService and single dumpHangedTest extension on the root project.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@AlexeyKuznetsov-DD AlexeyKuznetsov-DD self-assigned this Jul 2, 2026
@AlexeyKuznetsov-DD AlexeyKuznetsov-DD added tag: no release notes Changes to exclude from release notes type: refactoring comp: tooling Build & Tooling labels Jul 2, 2026
@AlexeyKuznetsov-DD AlexeyKuznetsov-DD requested a review from bric3 July 2, 2026 16:28
@AlexeyKuznetsov-DD AlexeyKuznetsov-DD marked this pull request as ready for review July 2, 2026 16:29
@AlexeyKuznetsov-DD AlexeyKuznetsov-DD requested a review from a team as a code owner July 2, 2026 16:29
@dd-octo-sts dd-octo-sts Bot added the tag: ai generated Largely based on code generated by an AI or LLM label Jul 2, 2026

@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: 63a02abe8f

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

Comment thread build.gradle.kts
allprojects {
group = "com.datadoghq"

apply(plugin = "dd-trace-java.dump-hanged-test")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not fan out plugin application through allprojects

With isolated projects enabled (-Dorg.gradle.unsafe.isolated-projects=true), this fan-out is still cross-project configuration: the root project calls Project.apply on every subproject through allprojects, which Gradle treats as an isolation violation (Gradle docs). This moves the old subprojects(::configure) violation into the build script and still blocks the mode this rework targets; apply the plugin from per-project convention/build logic instead.

Useful? React with 👍 / 👎.

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.

That's true, but we're not there yet (isolated projects). And this shall probably be solved by moving to convention plugins.

Comment on lines +59 to +60
val props = rootProject.extensions.findByType(DumpHangedTestProperties::class.java)
?: rootProject.extensions.create("dumpHangedTest", DumpHangedTestProperties::class.java)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not read the root extension from subprojects

When this plugin is applied to subprojects, those plugin instances read/create an extension on project.rootProject. With isolated projects enabled, Gradle forbids build logic for one project from directly accessing another project's mutable state (Gradle docs), so subproject configuration reports a Project.extensions access violation. Keep the dump offset in project-local providers/extensions or pass it via a shared service instead of reading the root extension from each subproject.

Useful? React with 👍 / 👎.

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.

While we're not targeting isolated project yet, I believe the comment is grounded. And this is not a good practice to configure another project, especially the root project from a sub project.

@datadog-prod-us1-5

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

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 56.96% (-0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 63a02ab | 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 — 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.04 s 14.07 s [-0.9%; +0.4%] (no difference)
startup:insecure-bank:tracing:Agent 12.93 s 12.98 s [-1.1%; +0.2%] (no difference)
startup:petclinic:appsec:Agent 16.94 s 16.67 s [+0.6%; +2.7%] (maybe worse)
startup:petclinic:iast:Agent 16.84 s 17.00 s [-1.8%; -0.1%] (maybe better)
startup:petclinic:profiling:Agent 16.75 s 16.97 s [-2.6%; +0.0%] (no difference)
startup:petclinic:sca:Agent 16.95 s 16.69 s [+0.7%; +2.5%] (maybe worse)
startup:petclinic:tracing:Agent 16.08 s 16.09 s [-1.0%; +0.8%] (no difference)

Commit: 63a02abe · 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.

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

I suggest to apply the plugin from the root project.

And like the version plugin it could apply on subprojects the necessary configuration

project.pluginManager.withPlugin("java") { }

Eventually rather than subProjects {}, using a gradle lifecyle beforeProject hook, might be better. But don't force it if subproject works.

Comment thread build.gradle.kts
allprojects {
group = "com.datadoghq"

apply(plugin = "dd-trace-java.dump-hanged-test")

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.

That's true, but we're not there yet (isolated projects). And this shall probably be solved by moving to convention plugins.

Comment on lines +59 to +60
val props = rootProject.extensions.findByType(DumpHangedTestProperties::class.java)
?: rootProject.extensions.create("dumpHangedTest", DumpHangedTestProperties::class.java)

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.

While we're not targeting isolated project yet, I believe the comment is grounded. And this is not a good practice to configure another project, especially the root project from a sub project.

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

Labels

comp: tooling Build & Tooling tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants