Skip to content

Conversation

@bric3
Copy link
Contributor

@bric3 bric3 commented Sep 5, 2025

What Does This Do

Disclaimer: This only touches the build part (i.e. Gradle).

The current InstrumentPlugin uses eager gradle API and inject a task to run after the compile task, and in doing so, exchanging their output. This approach is uncommon, create as many instrument task as they are compile tasks, and make it harder to predict compilation output.

This PR rethink the approach to a compilation post-processor. So instead of injecting a task in the gradle task graph, each compile task have a post-processor action.

Also, the plugin is renamed to dd-trace-java.build-time-instrumentation for better expressing intent. (Related configuration points are also renamed),

In doing so, it makes the intent of this plug-in easier to grasp.

On another note, the single Groovy file has been spread to distinct types.

Motivation

  • Good usage of Gradle API.
  • Make it lazy.
  • Rename better conveys what this plugins do: instrument at build time. The name dd-trace-java.build-time-instrumentation was chosen to align dd-trace-java.call-site-instrumentation. Also, searching these string will bring more focused results.

Avoid Gradle eager API, avoid messing with compile tasks avoid,

Helps going toward convention plug-ins.

Additional Notes

Related PRs

Related to

Blocked by

What does this plugin

ℹ️ italic word indicate Gradle linguo.

  • Registers an extension under the buildTimeInstrumentation name (previously instrument)
  • Registers a configuration (to declare dependencies) under the buildTimeInstrumentationPlugin name (previously instrumentPluginClasspath)
  • Applies to Java, Kotlin, Scala, and Groovy main sources
  • Appends a post-processing doLast action to each matching compile task

Currently, this build time instrumentation is applied on instrumentation modules :

  • datadog.trace.agent.tooling.muzzle.MuzzleGradlePlugin : Creates muzzle-references at compile time for classes extending InstrumenterModule. This generates metadata about instrumentation compatibility.
  • datadog.trace.agent.tooling.bytebuddy.NewTaskForGradlePlugin : Used for datadog.trace.instrumentation.java.concurrent.WrapRunnableAsNewTaskInstrumentation instrumentation, to replace datadog.trace.bootstrap.instrumentation.java.concurrent.NewTaskForPlaceholder#newTaskFor by java.util.concurrent.AbstractExecutorService#newTaskFor(java.lang.Runnable, T) (which is protected and not accessible during compilation).
  • datadog.trace.agent.tooling.bytebuddy.reqctx.RewriteRequestContextAdvicePlugin : Transforms classes annotated with @RequiresRequestContext to inject request context handling.

...and in the otel agent

  • datadog.opentelemetry.tooling.shim.OtelShimGradlePlugin: Injects Datadog's OpenTelemetry shim into specific OpenTelemetry API classes like DefaultOpenTelemetry, GlobalOpenTelemetry$ObfuscatedOpenTelemetry, ThreadLocalContextStorage, etc. This allows intercepting OpenTelemetry API calls at build-time.

Additional checks

As in #9514 I also checked the produced jars between master and this branch using my jardiff tool I already mentioned there (I crafted it for validating #9514, other tools didn't work or didn't perform what was needed).

Note

🔗 https://github.com/bric3/jardiff

Shortcomings:

  • not released anywhere, one has to build it - a possible idea would be to integrate this in a gradle plugin to make the diff easier to read.
  • needs JDK 25

Ran the following command on this branch (folder dd-trace-java-copy-2), and on master (folder dd-trace-java-copy-1).

$ ./gradlew :dd-java-agent:shadowJar

The following assumes that jardiff is actually this command java -jar jardiff/build/libs/jardiff-0.1.0-SNAPSHOT.jar, and assuming this is a Java 25. Also, while not strictly necessary the following snippets use delta to render the diff.

The following difference have been checked:

  • dd-java-agent

    jardiff ../dd-trace-java-copy-{1,2}/dd-java-agent/build/libs/dd-java-agent-1.58.0-SNAPSHOT.jar \
      -c classdata \
      --exclude "**/*.yaml,**/*.MF,**/*.version,*.version,*.txt" \
      | delta --syntax-theme=GitHub --light 

    No differences:

    image

@bric3 bric3 requested review from a team as code owners September 5, 2025 12:50
@bric3 bric3 requested a review from amarziali September 5, 2025 12:50
@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2025

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.

@bric3 bric3 marked this pull request as draft September 5, 2025 12:50
@bric3 bric3 added tag: no release notes Changes to exclude from release notes comp: tooling Build & Tooling labels Sep 5, 2025
Copy link
Contributor

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD left a comment

Choose a reason for hiding this comment

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

Just curious, what would be the benefit? Faster build?

@bric3 bric3 force-pushed the bdu/lazy-instrument-plugin branch from 248b4eb to 3094d50 Compare September 5, 2025 17:02
@bric3
Copy link
Contributor Author

bric3 commented Sep 10, 2025

Status report

The new approach of the instrument post-processing works in almost all simple projects, e.g.

Important

The diff was made by this custom tool https://github.com/bric3/jardiff

:dd-java-agent:instrumentation:iast-instrumenter
$ mise exec java@corretto-24 -- jardiff /Users/brice.dutheil/go/src/github.com/DataDog/dd-trace-java{-copy-1,}/dd-java-agent/instrumentation/iast-instrumenter/build/classes/java/main                      17:01:29
Comparing:
* /Users/brice.dutheil/go/src/github.com/DataDog/dd-trace-java-copy-1/dd-java-agent/instrumentation/iast-instrumenter/build/classes/java/main
* /Users/brice.dutheil/go/src/github.com/DataDog/dd-trace-java/dd-java-agent/instrumentation/iast-instrumenter/build/classes/java/main

✔️ META-INF/services/datadog.trace.agent.tooling.InstrumenterModule
✔️ datadog/trace/instrumentation/iastinstrumenter/IastExclusionTrie.class
✔️ datadog/trace/instrumentation/iastinstrumenter/IastInstrumentation$IastMatchers.class
✔️ datadog/trace/instrumentation/iastinstrumenter/IastHardcodedSecretListener$ReportSecretConsumer.class
✔️ datadog/trace/instrumentation/iastinstrumenter/SourceMapperImpl.class
✔️ datadog/trace/instrumentation/iastinstrumenter/StratumListener.class
✔️ datadog/trace/instrumentation/iastinstrumenter/IastInstrumentation.class
✔️ datadog/trace/instrumentation/iastinstrumenter/IastInstrumentation$Muzzle.class
✔️ datadog/trace/instrumentation/iastinstrumenter/IastHardcodedSecretListener.class
✔️ datadog/trace/instrumentation/iastinstrumenter/IastInstrumentation$IastCallSiteSupplier.class
✔️ datadog/trace/instrumentation/iastinstrumenter/IastInstrumentation$IastMatchers$1.class
✔️ datadog/trace/instrumentation/iastinstrumenter/telemetry/TelemetryCallSiteSupplier$IteratorAdapter.class
✔️ datadog/trace/instrumentation/iastinstrumenter/telemetry/TelemetryCallSiteSupplier$1.class
✔️ datadog/trace/instrumentation/iastinstrumenter/telemetry/TelemetryCallSiteSupplier.class
✔️ datadog/trace/instrumentation/iastinstrumenter/service/CallSitesLoader.class
:dd-java-agent:instrumentation:mule-4
$  mise exec java@corretto-24 -- jardiff /Users/brice.dutheil/go/src/github.com/DataDog/dd-trace-java{-copy-1,}/dd-java-agent/instrumentation/mule-4/build/classes/java/main                                 17:26:08
Comparing:
* /Users/brice.dutheil/go/src/github.com/DataDog/dd-trace-java-copy-1/dd-java-agent/instrumentation/mule-4/build/classes/java/main
* /Users/brice.dutheil/go/src/github.com/DataDog/dd-trace-java/dd-java-agent/instrumentation/mule-4/build/classes/java/main

✔️ META-INF/services/datadog.trace.agent.tooling.InstrumenterModule
✔️ datadog/trace/instrumentation/mule4/EventTracerInstrumentation.class
✔️ datadog/trace/instrumentation/mule4/ComponentMessageProcessorInstrumentation$ProcessAdvice.class
✔️ datadog/trace/instrumentation/mule4/AbstractMuleInstrumentation.class
✔️ datadog/trace/instrumentation/mule4/EventTracerInstrumentation$Muzzle.class
✔️ datadog/trace/instrumentation/mule4/SpanState.class
✔️ datadog/trace/instrumentation/mule4/ComponentMessageProcessorInstrumentation$Muzzle.class
✔️ datadog/trace/instrumentation/mule4/JpmsMuleInstrumentation$Muzzle.class
✔️ datadog/trace/instrumentation/mule4/ExecutionInitialSpanInfoInstrumentation$StoreComponentAdvice.class
✔️ datadog/trace/instrumentation/mule4/EventContextInstrumentation$Muzzle.class
✔️ datadog/trace/instrumentation/mule4/ComponentMessageProcessorInstrumentation.class
✔️ datadog/trace/instrumentation/mule4/EventContextCreationAdvice.class
✔️ datadog/trace/instrumentation/mule4/NoopMuleSpan.class
✔️ datadog/trace/instrumentation/mule4/DDEventTracer.class
✔️ datadog/trace/instrumentation/mule4/ExecutionInitialSpanInfoInstrumentation.class
✔️ datadog/trace/instrumentation/mule4/MuleDecorator.class
✔️ datadog/trace/instrumentation/mule4/EventTracerInstrumentation$SwapCoreTracerAdvice.class
✔️ datadog/trace/instrumentation/mule4/JpmsMuleInstrumentation.class
✔️ datadog/trace/instrumentation/mule4/ExecutionInitialSpanInfoInstrumentation$Muzzle.class
✔️ datadog/trace/instrumentation/mule4/EventContextInstrumentation.class
:dd-java-agent:instrumentation:play.2.4
:dd-java-agent:agent-otel:otel-bootstrap

jardiff on otel-bootstrap

Etc.

However, :dd-java-agent:instrumentation:jetty-9 is oddly configured and must be

mise exec java@corretto-24 -- jardiff /Users/brice.dutheil/go/src/github.com/DataDog/dd-trace-java{-copy-1,}/dd-java-agent/instrumentation/jetty-9/build/classes/java/main

And as such not all classes are available when post processing kicks in. Possibly this project needs a heavier setup refactoring.

Few other projects with non-standard configurations to fix

  • :dd-java-agent:instrumentation:play.2.4
  • :dd-java-agent:instrumentation:play.2.6

Executing a simple ./gradlew help :

~5K less created tasks during configuration
image

https://scans.gradle.com/s/jqasddzbs75ve/performance/configuration#summary-tasks-created-during-configuration

Note

~40k tasks created is still way too much and impacts the build performance considerably

versus master, with ~45k task created during configuration
image

https://scans.gradle.com/s/vg7nn7oitpx5k/performance/configuration#summary-tasks-created-during-configuration

@AlexeyKuznetsov-DD
Copy link
Contributor

AlexeyKuznetsov-DD commented Dec 17, 2025

Just a minor comment. Probably it make sense to refactor this plugin to Kotlin.
I did some naive 1-1 migration here
It is not working properly, so I will close my PR as you are working on it and have more context.

The current implementation was using bad practices in various ways,
`project.afterEvaluate`, task creation, explicit `dependsOn`

# Conflicts:
#	buildSrc/src/main/groovy/InstrumentPlugin.groovy
#	buildSrc/src/main/groovy/MuzzlePlugin.groovy
#	dd-java-agent/instrumentation/jetty-9/build.gradle

# Conflicts:
#	buildSrc/src/main/groovy/InstrumentPlugin.groovy
#	buildSrc/src/test/groovy/InstrumentPluginTest.groovy
#	dd-java-agent/instrumentation/play/play-2.4/build.gradle
#	dd-java-agent/instrumentation/play/play-2.6/build.gradle
@bric3 bric3 force-pushed the bdu/lazy-instrument-plugin branch from 899f804 to 9b5556c Compare December 31, 2025 09:06
@bric3
Copy link
Contributor Author

bric3 commented Dec 31, 2025

Just a minor comment. Probably it make sense to refactor this plugin to Kotlin.

Yes, but I'd rather do it, in a second pass. Once this settles down.

@pr-commenter
Copy link

pr-commenter bot commented Jan 5, 2026

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bdu/lazy-instrument-plugin
git_commit_date 1768383206 1768404509
git_commit_sha cb69759 ef16321
release_version 1.59.0-SNAPSHOT~cb69759fb3 1.58.0-SNAPSHOT~ef1632183d
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1768406491 1768406491
ci_job_id 1350147458 1350147458
ci_pipeline_id 90697845 90697845
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-ut6brahm 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-ut6brahm 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
module Agent Agent
parent None None

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 56 metrics, 9 unstable metrics.

Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.58.0-SNAPSHOT~ef1632183d, baseline=1.59.0-SNAPSHOT~cb69759fb3

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.087 s) : 0, 1087191
Total [baseline] (10.818 s) : 0, 10818319
Agent [candidate] (1.101 s) : 0, 1100606
Total [candidate] (10.922 s) : 0, 10922354
section appsec
Agent [baseline] (1.276 s) : 0, 1275612
Total [baseline] (11.219 s) : 0, 11218554
Agent [candidate] (1.268 s) : 0, 1268068
Total [candidate] (10.989 s) : 0, 10989038
section iast
Agent [baseline] (1.226 s) : 0, 1226373
Total [baseline] (11.208 s) : 0, 11208044
Agent [candidate] (1.229 s) : 0, 1228651
Total [candidate] (11.138 s) : 0, 11137860
section profiling
Agent [baseline] (1.207 s) : 0, 1206854
Total [baseline] (10.917 s) : 0, 10917070
Agent [candidate] (1.215 s) : 0, 1214767
Total [candidate] (11.002 s) : 0, 11002394
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.087 s -
Agent appsec 1.276 s 188.422 ms (17.3%)
Agent iast 1.226 s 139.183 ms (12.8%)
Agent profiling 1.207 s 119.663 ms (11.0%)
Total tracing 10.818 s -
Total appsec 11.219 s 400.235 ms (3.7%)
Total iast 11.208 s 389.725 ms (3.6%)
Total profiling 10.917 s 98.75 ms (0.9%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.101 s -
Agent appsec 1.268 s 167.461 ms (15.2%)
Agent iast 1.229 s 128.045 ms (11.6%)
Agent profiling 1.215 s 114.161 ms (10.4%)
Total tracing 10.922 s -
Total appsec 10.989 s 66.684 ms (0.6%)
Total iast 11.138 s 215.506 ms (2.0%)
Total profiling 11.002 s 80.04 ms (0.7%)
gantt
    title petclinic - break down per module: candidate=1.58.0-SNAPSHOT~ef1632183d, baseline=1.59.0-SNAPSHOT~cb69759fb3

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.184 ms) : 0, 1184
crashtracking [candidate] (1.208 ms) : 0, 1208
BytebuddyAgent [baseline] (652.519 ms) : 0, 652519
BytebuddyAgent [candidate] (661.043 ms) : 0, 661043
GlobalTracer [baseline] (283.496 ms) : 0, 283496
GlobalTracer [candidate] (286.757 ms) : 0, 286757
AppSec [baseline] (32.638 ms) : 0, 32638
AppSec [candidate] (33.172 ms) : 0, 33172
Debugger [baseline] (68.305 ms) : 0, 68305
Debugger [candidate] (69.012 ms) : 0, 69012
Remote Config [baseline] (645.3 µs) : 0, 645
Remote Config [candidate] (687.229 µs) : 0, 687
Telemetry [baseline] (9.025 ms) : 0, 9025
Telemetry [candidate] (9.035 ms) : 0, 9035
Flare Poller [baseline] (3.778 ms) : 0, 3778
Flare Poller [candidate] (3.836 ms) : 0, 3836
section appsec
crashtracking [baseline] (1.195 ms) : 0, 1195
crashtracking [candidate] (1.189 ms) : 0, 1189
BytebuddyAgent [baseline] (696.03 ms) : 0, 696030
BytebuddyAgent [candidate] (692.657 ms) : 0, 692657
GlobalTracer [baseline] (260.039 ms) : 0, 260039
GlobalTracer [candidate] (259.34 ms) : 0, 259340
AppSec [baseline] (172.852 ms) : 0, 172852
AppSec [candidate] (172.118 ms) : 0, 172118
Debugger [baseline] (70.736 ms) : 0, 70736
Debugger [candidate] (68.697 ms) : 0, 68697
Remote Config [baseline] (799.235 µs) : 0, 799
Remote Config [candidate] (828.104 µs) : 0, 828
Telemetry [baseline] (9.647 ms) : 0, 9647
Telemetry [candidate] (9.421 ms) : 0, 9421
Flare Poller [baseline] (3.992 ms) : 0, 3992
Flare Poller [candidate] (3.788 ms) : 0, 3788
IAST [baseline] (24.753 ms) : 0, 24753
IAST [candidate] (24.57 ms) : 0, 24570
section iast
crashtracking [baseline] (1.179 ms) : 0, 1179
crashtracking [candidate] (1.195 ms) : 0, 1195
BytebuddyAgent [baseline] (791.739 ms) : 0, 791739
BytebuddyAgent [candidate] (794.094 ms) : 0, 794094
GlobalTracer [baseline] (257.378 ms) : 0, 257378
GlobalTracer [candidate] (257.708 ms) : 0, 257708
AppSec [baseline] (34.598 ms) : 0, 34598
AppSec [candidate] (34.719 ms) : 0, 34719
Debugger [baseline] (66.061 ms) : 0, 66061
Debugger [candidate] (65.749 ms) : 0, 65749
Remote Config [baseline] (593.788 µs) : 0, 594
Remote Config [candidate] (565.294 µs) : 0, 565
Telemetry [baseline] (8.58 ms) : 0, 8580
Telemetry [candidate] (8.529 ms) : 0, 8529
Flare Poller [baseline] (3.642 ms) : 0, 3642
Flare Poller [candidate] (3.544 ms) : 0, 3544
IAST [baseline] (27.0 ms) : 0, 27000
IAST [candidate] (26.964 ms) : 0, 26964
section profiling
crashtracking [baseline] (1.225 ms) : 0, 1225
crashtracking [candidate] (1.221 ms) : 0, 1221
BytebuddyAgent [baseline] (702.708 ms) : 0, 702708
BytebuddyAgent [candidate] (709.41 ms) : 0, 709410
GlobalTracer [baseline] (220.899 ms) : 0, 220899
GlobalTracer [candidate] (223.294 ms) : 0, 223294
AppSec [baseline] (32.192 ms) : 0, 32192
AppSec [candidate] (32.652 ms) : 0, 32652
Debugger [baseline] (68.617 ms) : 0, 68617
Debugger [candidate] (67.961 ms) : 0, 67961
Remote Config [baseline] (666.769 µs) : 0, 667
Remote Config [candidate] (663.821 µs) : 0, 664
Telemetry [baseline] (9.038 ms) : 0, 9038
Telemetry [candidate] (8.944 ms) : 0, 8944
Flare Poller [baseline] (3.78 ms) : 0, 3780
Flare Poller [candidate] (3.761 ms) : 0, 3761
ProfilingAgent [baseline] (97.747 ms) : 0, 97747
ProfilingAgent [candidate] (96.748 ms) : 0, 96748
Profiling [baseline] (98.326 ms) : 0, 98326
Profiling [candidate] (97.32 ms) : 0, 97320
Loading
Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.58.0-SNAPSHOT~ef1632183d, baseline=1.59.0-SNAPSHOT~cb69759fb3

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.088 s) : 0, 1087650
Total [baseline] (8.786 s) : 0, 8785516
Agent [candidate] (1.086 s) : 0, 1086113
Total [candidate] (8.761 s) : 0, 8760678
section iast
Agent [baseline] (1.226 s) : 0, 1225631
Total [baseline] (9.326 s) : 0, 9325738
Agent [candidate] (1.234 s) : 0, 1234179
Total [candidate] (9.346 s) : 0, 9346271
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.088 s -
Agent iast 1.226 s 137.98 ms (12.7%)
Total tracing 8.786 s -
Total iast 9.326 s 540.222 ms (6.1%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.086 s -
Agent iast 1.234 s 148.067 ms (13.6%)
Total tracing 8.761 s -
Total iast 9.346 s 585.593 ms (6.7%)
gantt
    title insecure-bank - break down per module: candidate=1.58.0-SNAPSHOT~ef1632183d, baseline=1.59.0-SNAPSHOT~cb69759fb3

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.193 ms) : 0, 1193
crashtracking [candidate] (1.18 ms) : 0, 1180
BytebuddyAgent [baseline] (653.513 ms) : 0, 653513
BytebuddyAgent [candidate] (652.811 ms) : 0, 652811
GlobalTracer [baseline] (283.385 ms) : 0, 283385
GlobalTracer [candidate] (283.474 ms) : 0, 283474
AppSec [baseline] (32.684 ms) : 0, 32684
AppSec [candidate] (32.773 ms) : 0, 32773
Debugger [baseline] (67.756 ms) : 0, 67756
Debugger [candidate] (66.92 ms) : 0, 66920
Remote Config [baseline] (649.944 µs) : 0, 650
Remote Config [candidate] (645.604 µs) : 0, 646
Telemetry [baseline] (8.992 ms) : 0, 8992
Telemetry [candidate] (8.976 ms) : 0, 8976
Flare Poller [baseline] (3.815 ms) : 0, 3815
Flare Poller [candidate] (3.816 ms) : 0, 3816
section iast
crashtracking [baseline] (1.189 ms) : 0, 1189
crashtracking [candidate] (1.192 ms) : 0, 1192
BytebuddyAgent [baseline] (792.413 ms) : 0, 792413
BytebuddyAgent [candidate] (799.065 ms) : 0, 799065
GlobalTracer [baseline] (257.071 ms) : 0, 257071
GlobalTracer [candidate] (258.26 ms) : 0, 258260
AppSec [baseline] (34.638 ms) : 0, 34638
AppSec [candidate] (32.932 ms) : 0, 32932
Debugger [baseline] (64.987 ms) : 0, 64987
Debugger [candidate] (67.109 ms) : 0, 67109
Remote Config [baseline] (598.235 µs) : 0, 598
Remote Config [candidate] (586.469 µs) : 0, 586
Telemetry [baseline] (8.528 ms) : 0, 8528
Telemetry [candidate] (8.491 ms) : 0, 8491
Flare Poller [baseline] (3.571 ms) : 0, 3571
Flare Poller [candidate] (3.527 ms) : 0, 3527
IAST [baseline] (27.069 ms) : 0, 27069
IAST [candidate] (27.264 ms) : 0, 27264
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bdu/lazy-instrument-plugin
git_commit_date 1768383206 1768404509
git_commit_sha cb69759 ef16321
release_version 1.59.0-SNAPSHOT~cb69759fb3 1.58.0-SNAPSHOT~ef1632183d
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1768406981 1768406981
ci_job_id 1350147460 1350147460
ci_pipeline_id 90697845 90697845
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-ffpz624o 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-ffpz624o 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

Found 0 performance improvements and 3 performance regressions! Performance is the same for 13 metrics, 20 unstable metrics.

scenario Δ mean agg_http_req_duration_p50 Δ mean agg_http_req_duration_p95 Δ mean throughput candidate mean agg_http_req_duration_p50 candidate mean agg_http_req_duration_p95 candidate mean throughput baseline mean agg_http_req_duration_p50 baseline mean agg_http_req_duration_p95 baseline mean throughput
scenario:load:petclinic:code_origins:high_load worse
[+0.639ms; +1.448ms] or [+3.701%; +8.386%]
worse
[+0.665ms; +2.073ms] or [+2.325%; +7.242%]
unstable
[-38.667op/s; +11.542op/s] or [-14.652%; +4.374%]
18.305ms 29.990ms 250.344op/s 17.262ms 28.621ms 263.906op/s
scenario:load:petclinic:iast:high_load worse
[+396.649µs; +815.130µs] or [+2.311%; +4.749%]
unsure
[+100.382µs; +1069.614µs] or [+0.356%; +3.791%]
unstable
[-33.147op/s; +16.710op/s] or [-12.455%; +6.279%]
17.771ms 28.799ms 257.906op/s 17.165ms 28.214ms 266.125op/s
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.58.0-SNAPSHOT~ef1632183d, baseline=1.59.0-SNAPSHOT~cb69759fb3
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.174 ms) : 1163, 1185
.   : milestone, 1174,
iast (3.216 ms) : 3173, 3258
.   : milestone, 3216,
iast_FULL (5.737 ms) : 5680, 5794
.   : milestone, 5737,
iast_GLOBAL (3.591 ms) : 3540, 3643
.   : milestone, 3591,
profiling (2.025 ms) : 2007, 2043
.   : milestone, 2025,
tracing (1.876 ms) : 1860, 1892
.   : milestone, 1876,
section candidate
no_agent (1.163 ms) : 1151, 1174
.   : milestone, 1163,
iast (3.174 ms) : 3134, 3214
.   : milestone, 3174,
iast_FULL (5.758 ms) : 5701, 5815
.   : milestone, 5758,
iast_GLOBAL (3.562 ms) : 3512, 3613
.   : milestone, 3562,
profiling (2.229 ms) : 2207, 2252
.   : milestone, 2229,
tracing (1.795 ms) : 1780, 1811
.   : milestone, 1795,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.174 ms [1.163 ms, 1.185 ms] -
iast 3.216 ms [3.173 ms, 3.258 ms] 2.042 ms (173.9%)
iast_FULL 5.737 ms [5.68 ms, 5.794 ms] 4.563 ms (388.6%)
iast_GLOBAL 3.591 ms [3.54 ms, 3.643 ms] 2.417 ms (205.9%)
profiling 2.025 ms [2.007 ms, 2.043 ms] 850.906 µs (72.5%)
tracing 1.876 ms [1.86 ms, 1.892 ms] 702.196 µs (59.8%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.163 ms [1.151 ms, 1.174 ms] -
iast 3.174 ms [3.134 ms, 3.214 ms] 2.011 ms (173.0%)
iast_FULL 5.758 ms [5.701 ms, 5.815 ms] 4.595 ms (395.3%)
iast_GLOBAL 3.562 ms [3.512 ms, 3.613 ms] 2.4 ms (206.4%)
profiling 2.229 ms [2.207 ms, 2.252 ms] 1.067 ms (91.8%)
tracing 1.795 ms [1.78 ms, 1.811 ms] 632.853 µs (54.4%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.58.0-SNAPSHOT~ef1632183d, baseline=1.59.0-SNAPSHOT~cb69759fb3
    dateFormat X
    axisFormat %s
section baseline
no_agent (17.98 ms) : 17800, 18161
.   : milestone, 17980,
appsec (18.21 ms) : 18027, 18392
.   : milestone, 18210,
code_origins (17.682 ms) : 17506, 17858
.   : milestone, 17682,
iast (17.533 ms) : 17359, 17708
.   : milestone, 17533,
profiling (19.805 ms) : 19604, 20006
.   : milestone, 19805,
tracing (17.724 ms) : 17547, 17900
.   : milestone, 17724,
section candidate
no_agent (18.894 ms) : 18698, 19091
.   : milestone, 18894,
appsec (18.3 ms) : 18114, 18486
.   : milestone, 18300,
code_origins (18.641 ms) : 18452, 18831
.   : milestone, 18641,
iast (18.092 ms) : 17915, 18269
.   : milestone, 18092,
profiling (19.042 ms) : 18851, 19234
.   : milestone, 19042,
tracing (17.439 ms) : 17266, 17612
.   : milestone, 17439,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 17.98 ms [17.8 ms, 18.161 ms] -
appsec 18.21 ms [18.027 ms, 18.392 ms] 229.375 µs (1.3%)
code_origins 17.682 ms [17.506 ms, 17.858 ms] -298.036 µs (-1.7%)
iast 17.533 ms [17.359 ms, 17.708 ms] -447.104 µs (-2.5%)
profiling 19.805 ms [19.604 ms, 20.006 ms] 1.825 ms (10.1%)
tracing 17.724 ms [17.547 ms, 17.9 ms] -256.468 µs (-1.4%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 18.894 ms [18.698 ms, 19.091 ms] -
appsec 18.3 ms [18.114 ms, 18.486 ms] -594.652 µs (-3.1%)
code_origins 18.641 ms [18.452 ms, 18.831 ms] -253.255 µs (-1.3%)
iast 18.092 ms [17.915 ms, 18.269 ms] -802.441 µs (-4.2%)
profiling 19.042 ms [18.851 ms, 19.234 ms] 147.705 µs (0.8%)
tracing 17.439 ms [17.266 ms, 17.612 ms] -1.455 ms (-7.7%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bdu/lazy-instrument-plugin
git_commit_date 1768383206 1768404509
git_commit_sha cb69759 ef16321
release_version 1.59.0-SNAPSHOT~cb69759fb3 1.58.0-SNAPSHOT~ef1632183d
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1768406665 1768406665
ci_job_id 1350147462 1350147462
ci_pipeline_id 90697845 90697845
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-7a2xs4dw 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-7a2xs4dw 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 1 unstable metrics.

Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.58.0-SNAPSHOT~ef1632183d, baseline=1.59.0-SNAPSHOT~cb69759fb3
    dateFormat X
    axisFormat %s
section baseline
no_agent (14.715 s) : 14715000, 14715000
.   : milestone, 14715000,
appsec (14.773 s) : 14773000, 14773000
.   : milestone, 14773000,
iast (18.073 s) : 18073000, 18073000
.   : milestone, 18073000,
iast_GLOBAL (17.897 s) : 17897000, 17897000
.   : milestone, 17897000,
profiling (14.932 s) : 14932000, 14932000
.   : milestone, 14932000,
tracing (14.608 s) : 14608000, 14608000
.   : milestone, 14608000,
section candidate
no_agent (15.252 s) : 15252000, 15252000
.   : milestone, 15252000,
appsec (14.637 s) : 14637000, 14637000
.   : milestone, 14637000,
iast (18.52 s) : 18520000, 18520000
.   : milestone, 18520000,
iast_GLOBAL (17.562 s) : 17562000, 17562000
.   : milestone, 17562000,
profiling (14.796 s) : 14796000, 14796000
.   : milestone, 14796000,
tracing (14.761 s) : 14761000, 14761000
.   : milestone, 14761000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.715 s [14.715 s, 14.715 s] -
appsec 14.773 s [14.773 s, 14.773 s] 58.0 ms (0.4%)
iast 18.073 s [18.073 s, 18.073 s] 3.358 s (22.8%)
iast_GLOBAL 17.897 s [17.897 s, 17.897 s] 3.182 s (21.6%)
profiling 14.932 s [14.932 s, 14.932 s] 217.0 ms (1.5%)
tracing 14.608 s [14.608 s, 14.608 s] -107.0 ms (-0.7%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.252 s [15.252 s, 15.252 s] -
appsec 14.637 s [14.637 s, 14.637 s] -615.0 ms (-4.0%)
iast 18.52 s [18.52 s, 18.52 s] 3.268 s (21.4%)
iast_GLOBAL 17.562 s [17.562 s, 17.562 s] 2.31 s (15.1%)
profiling 14.796 s [14.796 s, 14.796 s] -456.0 ms (-3.0%)
tracing 14.761 s [14.761 s, 14.761 s] -491.0 ms (-3.2%)
Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.58.0-SNAPSHOT~ef1632183d, baseline=1.59.0-SNAPSHOT~cb69759fb3
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.475 ms) : 1464, 1487
.   : milestone, 1475,
appsec (3.723 ms) : 3501, 3945
.   : milestone, 3723,
iast (2.227 ms) : 2161, 2293
.   : milestone, 2227,
iast_GLOBAL (2.267 ms) : 2200, 2333
.   : milestone, 2267,
profiling (2.111 ms) : 2055, 2167
.   : milestone, 2111,
tracing (2.053 ms) : 2001, 2105
.   : milestone, 2053,
section candidate
no_agent (1.474 ms) : 1463, 1486
.   : milestone, 1474,
appsec (3.693 ms) : 3477, 3909
.   : milestone, 3693,
iast (2.226 ms) : 2160, 2291
.   : milestone, 2226,
iast_GLOBAL (2.267 ms) : 2201, 2333
.   : milestone, 2267,
profiling (2.097 ms) : 2042, 2152
.   : milestone, 2097,
tracing (2.061 ms) : 2009, 2112
.   : milestone, 2061,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.475 ms [1.464 ms, 1.487 ms] -
appsec 3.723 ms [3.501 ms, 3.945 ms] 2.247 ms (152.4%)
iast 2.227 ms [2.161 ms, 2.293 ms] 751.759 µs (51.0%)
iast_GLOBAL 2.267 ms [2.2 ms, 2.333 ms] 791.385 µs (53.6%)
profiling 2.111 ms [2.055 ms, 2.167 ms] 635.786 µs (43.1%)
tracing 2.053 ms [2.001 ms, 2.105 ms] 577.822 µs (39.2%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.474 ms [1.463 ms, 1.486 ms] -
appsec 3.693 ms [3.477 ms, 3.909 ms] 2.219 ms (150.5%)
iast 2.226 ms [2.16 ms, 2.291 ms] 751.392 µs (51.0%)
iast_GLOBAL 2.267 ms [2.201 ms, 2.333 ms] 792.999 µs (53.8%)
profiling 2.097 ms [2.042 ms, 2.152 ms] 623.04 µs (42.3%)
tracing 2.061 ms [2.009 ms, 2.112 ms] 586.471 µs (39.8%)

@bric3 bric3 changed the title Rewrite InstrumentPlugin to be lazy Rewrite InstrumentPlugin as compilation post-processor and lazy Jan 5, 2026
@bric3 bric3 force-pushed the bdu/lazy-instrument-plugin branch from a485d08 to 83aa2a4 Compare January 6, 2026 12:41
@bric3 bric3 changed the title Rewrite InstrumentPlugin as compilation post-processor and lazy Rewrite build-time instrumentation as compilation post-processor (using Gradle lazy APIs) Jan 6, 2026
@bric3 bric3 force-pushed the bdu/lazy-instrument-plugin branch from 83aa2a4 to 5311fd3 Compare January 6, 2026 12:53
@bric3 bric3 marked this pull request as ready for review January 6, 2026 15:43
@bric3 bric3 requested review from a team as code owners January 6, 2026 15:43
@bric3 bric3 requested review from AlexeyKuznetsov-DD, claponcet, manuel-alvarez-alvarez and mcculls and removed request for a team January 6, 2026 15:43
Copy link
Contributor

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD left a comment

Choose a reason for hiding this comment

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

LGTM, left minor notes and questions.

logger.info('[BuildTimeInstrumentationPlugin] Applying buildTimeInstrumentationPlugin configuration as compile task input')
it.inputs.files(project.configurations.named(BUILD_TIME_INSTRUMENTATION_PLUGIN_CONFIGURATION))

if (it.source.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this check? if it was already checked on line 103?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, maybe this can be removed.

Comment on lines +124 to +128
it.inputs.property("javaVersion", javaVersion)

it.inputs.property("plugins", extension.plugins)

it.inputs.files(extension.additionalClasspath)
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor - remove empty lines to keep lines logically together.

Suggested change
it.inputs.property("javaVersion", javaVersion)
it.inputs.property("plugins", extension.plugins)
it.inputs.files(extension.additionalClasspath)
it.inputs.property("javaVersion", javaVersion)
it.inputs.property("plugins", extension.plugins)
it.inputs.files(extension.additionalClasspath)

tmpUninstrumentedClasses
)

// This were the post processing happens, i.e. were the instrumentation is applied
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: I would re-phrase this comment a bit, probably make it short: // Apply instrumentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
// This were the post processing happens, i.e. were the instrumentation is applied
// Post-process classes with instrumentation

Comment on lines +56 to +62
logger.info(
"[InstrumentPostProcessingAction] About to instrument classes \n" +
" javaVersion=${javaVersion}, \n" +
" plugins=${plugins.get()}, \n" +
" instrumentingClassPath=${instrumentingClassPath.files}, \n" +
" rawClassesDirectory=${compilerOutputDirectory.get().asFile}"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: can we use multiline string here?

logger.info('[BuildTimeInstrumentationPlugin] Applying buildTimeInstrumentationPlugin configuration as compile task input')
it.inputs.files(project.configurations.named(BUILD_TIME_INSTRUMENTATION_PLUGIN_CONFIGURATION))

if (it.source.isEmpty()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, maybe this can be removed.

tmpUninstrumentedClasses
)

// This were the post processing happens, i.e. were the instrumentation is applied
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
// This were the post processing happens, i.e. were the instrumentation is applied
// Post-process classes with instrumentation

it.dependencies.add(subProj.dependencies.project(path: ':dd-java-agent:agent-tooling', configuration: 'instrumentPluginClasspath'))
it.dependencies.add(subProj.dependencies.project(
path: ':dd-java-agent:agent-tooling',
configuration: 'buildTimeInstrumentationPlugin'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note: Maybe I'll rename this configuration to avoid confusion with the instrumentation plugin.

Something like

        configuration: 'buildTimeInstrumentationPlugin'
        configuration: 'buildTimeInstrumentationToolingPlugins'

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

Labels

comp: tooling Build & Tooling tag: needs investigation Issues needing investigations tag: no release notes Changes to exclude from release notes type: enhancement Enhancements and improvements type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants