Introduce module-kind convention plugins - #11620
Open
bric3 wants to merge 26 commits into
Open
Conversation
Contributor
|
🎯 Code Coverage (details) 🔗 Commit SHA: c9629e4 | Docs | Datadog PR Page | Give us feedback! |
bric3
marked this pull request as ready for review
June 10, 2026 15:53
bric3
requested review from
claponcet,
dd-oleksii,
dudikeleti,
jandro996,
leoromanovsky and
ygree
and removed request for
a team
June 10, 2026 15:53
mcculls
reviewed
Jul 15, 2026
mcculls
reviewed
Jul 15, 2026
mcculls
reviewed
Jul 15, 2026
mcculls
reviewed
Jul 15, 2026
mcculls
reviewed
Jul 15, 2026
mcculls
reviewed
Jul 15, 2026
mcculls
left a comment
Contributor
There was a problem hiding this comment.
I think moving to conventions is definitely the right direction - but the categories need some work, especially around internals. For example, when is something a component rather than a util? And should we be putting utils in the same convention as product libraries.
bric3
commented
Jul 20, 2026
bric3
left a comment
Contributor
Author
There was a problem hiding this comment.
Thanks for the thoughtful comments
jandro996
approved these changes
Jul 23, 2026
jandro996
left a comment
Member
There was a problem hiding this comment.
Reviewed overall, and more specifically the files under my CODEOWNERS scope (asm-java: appsec/iast/aiguard build.gradle files and related instrumentation modules)
# Conflicts: # components/json/build.gradle.kts # dd-java-agent/agent-bootstrap/build.gradle # dd-java-agent/agent-profiling/profiling-ddprof/build.gradle # dd-java-agent/instrumentation/avro-1.11.3/build.gradle # dd-java-agent/instrumentation/build.gradle # dd-java-agent/instrumentation/datanucleus-4.0.5/build.gradle # dd-java-agent/instrumentation/datastax-cassandra/datastax-cassandra-3.0/build.gradle # dd-java-agent/instrumentation/graal/build.gradle # dd-java-agent/instrumentation/jdbc/build.gradle # dd-java-agent/instrumentation/opentelemetry/build.gradle # dd-java-agent/instrumentation/protobuf-3.0/build.gradle # dd-trace-api/build.gradle.kts # dd-trace-core/build.gradle # dd-trace-ot/build.gradle.kts # internal-api/build.gradle.kts # internal-api/internal-api-9/build.gradle.kts # telemetry/build.gradle.kts # utils/test-agent-utils/decoder/build.gradle.kts # utils/test-utils/build.gradle.kts
bric3
force-pushed
the
bdu/introduce-first-module-conventions
branch
from
July 30, 2026 12:01
661fb4e to
ea102de
Compare
mcculls
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Does This Do
Introduces module-kind convention plugins for Java-backed Gradle modules and applies them from
plugins {}while keeping the existing script plugins as the behavior source.The basic change is usually removing the
apply fromof thejavaandpublishscript plugins, and use the modern recommended plugins block with the identified module kind :In particular these are the identified module kind, in this PR, it's likely some kind are not represented in this PR, and that's not the goal to be exhaustive at this stage, it can be refined later (for example for the shared modules in the agent jar).
dd-trace-java.module.product-subsystemdd-trace-java.module.annotation-processordd-trace-java.module.bootstrap-componentIt is for code whose artifact is intentionally part of the agent's bootstrap surface. It is expected to be included at the root of the final agent jar, currently directly through
shadowInclude.dd-trace-java/dd-java-agent/build.gradle
Lines 395 to 402 in 0a0226c
The classes in these modules (and their dependencies) are visible through the JVM bootstrap classloader once the agent jar is appended to the bootstrap search path. This the strictest category because the code can run very early and can be referenced from instrumented application classes.
Note, the dependencies of these modules do not use this convention.
The bootstrap modules and their dependencies happens to be excluded from the
shared/prefixdd-trace-java/dd-java-agent/build.gradle
Lines 267 to 282 in 0a0226c
dd-trace-java.module.distributable.api(here the dot is intended, as the idea is to have adistributable.agent)Applies the
publish.gradleplugin script.dd-trace-java.module.instrumentationInstrumentation modules are named according to their minimal supported version, however for "common" instrumented parts, modules like
<lib>-commonexists, as they are instrumentation per se, they do not require a different more specialized convention. In other words they also have to applydd-trace-java.module.instrumentation.dd-trace-java.module.internal-apidd-trace-java.module.product-librarydd-trace-java.module.internal-libraryThis is for internal implementation libraries. They are regular shared implementation code, generally intended to be consumed by other agent modules and often packaged inside
shared/,trace/, or a product-specific directory in the final jar. Some of them can still land at the jar root (bootstrap) transitively when a bootstrap component depends on them, for examplemetrics-agent; that does not necessarily make them bootstrap components. It just means a bootstrap component needs them.dd-trace-java.module.platform-componentIt is for low-level platform building blocks shared by several parts of the agent: context, json, annotations, HTTP primitives, etc. These modules are not agent
products and are not feature implementations. They are reusable infrastructure. They may end up bootstrap-visible when a bootstrap module depends on them, but that is a consequence of who consumes them.
dd-trace-java.module.smoke-testdd-trace-java.module.testing-supportI chose
moduleprefix as a way to convey the "higher level" module kind. While there might be other lower level technical conventions.Small point of attention to the
:dd-java-agent:instrumentationmodule, this PR replaces this checkBy checking if the sub project has the
dd-trace-java.module.instrumentationconvention, if it does it applies the necessary conventions for the instrumentation, so it just wraps existing code within the following closure:Motivation
Prepare a gradual migration from lower-level script plugin application to higher-level conventions that describe what each module is.
Gradle references used for this migration direction:
Additional Details
The current forbidden-apis wiring for instrumentation modules is preserved: instrumentation tasks read both
main.txtandinstrumentation.txt.:dd-java-agent:instrumentationitself is intentionally not migrated further here. Its aggregator-specific wiring, especially around muzzle reports, needs preparatory work before moving more of that project into convention-plugin logic.jardiffwas used to compare the agent jar frommasterand this branch. The agent jar contains both.classand.classdataentries, so the stricter check includes both and coalesces.classdataas class-like bytecode:Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issue/merge. You can also:/merge --commit-message "..."/merge -c/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)Jira ticket: [N/A]