-
Notifications
You must be signed in to change notification settings - Fork 312
Update apache instrumentation build.gradle files to kotlin #9551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
🎯 Code Coverage 🔗 Commit SHA: 3bca58b | Docs | Was this helpful? Give us feedback! |
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 50 metrics, 9 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.54.0-SNAPSHOT~3bca58b0ec, baseline=1.54.0-SNAPSHOT~c68b54c4d1
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.06 s) : 0, 1060472
Total [baseline] (10.875 s) : 0, 10874918
Agent [candidate] (1.062 s) : 0, 1062404
Total [candidate] (10.661 s) : 0, 10661171
section appsec
Agent [baseline] (1.239 s) : 0, 1239486
Total [baseline] (11.075 s) : 0, 11075334
Agent [candidate] (1.236 s) : 0, 1235601
Total [candidate] (11.019 s) : 0, 11019037
section iast
Agent [baseline] (1.188 s) : 0, 1188022
Total [baseline] (10.958 s) : 0, 10958327
Agent [candidate] (1.189 s) : 0, 1188536
Total [candidate] (11.049 s) : 0, 11049226
section profiling
Agent [baseline] (1.211 s) : 0, 1211370
Total [baseline] (10.917 s) : 0, 10917397
Agent [candidate] (1.208 s) : 0, 1207919
Total [candidate] (10.847 s) : 0, 10847002
gantt
title petclinic - break down per module: candidate=1.54.0-SNAPSHOT~3bca58b0ec, baseline=1.54.0-SNAPSHOT~c68b54c4d1
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.449 ms) : 0, 1449
crashtracking [candidate] (1.446 ms) : 0, 1446
BytebuddyAgent [baseline] (732.031 ms) : 0, 732031
BytebuddyAgent [candidate] (733.448 ms) : 0, 733448
GlobalTracer [baseline] (252.125 ms) : 0, 252125
GlobalTracer [candidate] (252.555 ms) : 0, 252555
AppSec [baseline] (30.526 ms) : 0, 30526
AppSec [candidate] (30.582 ms) : 0, 30582
Debugger [baseline] (6.387 ms) : 0, 6387
Debugger [candidate] (6.444 ms) : 0, 6444
Remote Config [baseline] (694.837 µs) : 0, 695
Remote Config [candidate] (692.107 µs) : 0, 692
Telemetry [baseline] (16.213 ms) : 0, 16213
Telemetry [candidate] (16.217 ms) : 0, 16217
section appsec
crashtracking [baseline] (1.454 ms) : 0, 1454
crashtracking [candidate] (1.445 ms) : 0, 1445
BytebuddyAgent [baseline] (758.16 ms) : 0, 758160
BytebuddyAgent [candidate] (756.335 ms) : 0, 756335
GlobalTracer [baseline] (247.572 ms) : 0, 247572
GlobalTracer [candidate] (246.015 ms) : 0, 246015
IAST [baseline] (23.975 ms) : 0, 23975
IAST [candidate] (23.847 ms) : 0, 23847
AppSec [baseline] (171.807 ms) : 0, 171807
AppSec [candidate] (171.611 ms) : 0, 171611
Debugger [baseline] (6.062 ms) : 0, 6062
Debugger [candidate] (6.013 ms) : 0, 6013
Remote Config [baseline] (646.306 µs) : 0, 646
Remote Config [candidate] (640.718 µs) : 0, 641
Telemetry [baseline] (8.589 ms) : 0, 8589
Telemetry [candidate] (8.491 ms) : 0, 8491
section iast
crashtracking [baseline] (1.447 ms) : 0, 1447
crashtracking [candidate] (1.45 ms) : 0, 1450
BytebuddyAgent [baseline] (850.286 ms) : 0, 850286
BytebuddyAgent [candidate] (850.409 ms) : 0, 850409
GlobalTracer [baseline] (245.399 ms) : 0, 245399
GlobalTracer [candidate] (243.003 ms) : 0, 243003
IAST [baseline] (27.056 ms) : 0, 27056
IAST [candidate] (32.484 ms) : 0, 32484
AppSec [baseline] (28.064 ms) : 0, 28064
AppSec [candidate] (25.408 ms) : 0, 25408
Debugger [baseline] (6.002 ms) : 0, 6002
Debugger [candidate] (6.091 ms) : 0, 6091
Remote Config [baseline] (591.872 µs) : 0, 592
Remote Config [candidate] (600.152 µs) : 0, 600
Telemetry [baseline] (8.286 ms) : 0, 8286
Telemetry [candidate] (8.085 ms) : 0, 8085
section profiling
crashtracking [baseline] (1.442 ms) : 0, 1442
crashtracking [candidate] (1.44 ms) : 0, 1440
BytebuddyAgent [baseline] (763.106 ms) : 0, 763106
BytebuddyAgent [candidate] (761.862 ms) : 0, 761862
GlobalTracer [baseline] (233.549 ms) : 0, 233549
GlobalTracer [candidate] (232.851 ms) : 0, 232851
AppSec [baseline] (30.47 ms) : 0, 30470
AppSec [candidate] (30.994 ms) : 0, 30994
Debugger [baseline] (10.611 ms) : 0, 10611
Debugger [candidate] (12.11 ms) : 0, 12110
Remote Config [baseline] (1.538 ms) : 0, 1538
Remote Config [candidate] (1.427 ms) : 0, 1427
Telemetry [baseline] (11.182 ms) : 0, 11182
Telemetry [candidate] (9.373 ms) : 0, 9373
ProfilingAgent [baseline] (107.453 ms) : 0, 107453
ProfilingAgent [candidate] (106.75 ms) : 0, 106750
Profiling [baseline] (108.106 ms) : 0, 108106
Profiling [candidate] (107.401 ms) : 0, 107401
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.54.0-SNAPSHOT~3bca58b0ec, baseline=1.54.0-SNAPSHOT~c68b54c4d1
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.061 s) : 0, 1060566
Total [baseline] (8.618 s) : 0, 8617639
Agent [candidate] (1.061 s) : 0, 1060866
Total [candidate] (8.621 s) : 0, 8620971
section iast
Agent [baseline] (1.188 s) : 0, 1188394
Total [baseline] (9.304 s) : 0, 9303970
Agent [candidate] (1.195 s) : 0, 1194686
Total [candidate] (9.361 s) : 0, 9361436
gantt
title insecure-bank - break down per module: candidate=1.54.0-SNAPSHOT~3bca58b0ec, baseline=1.54.0-SNAPSHOT~c68b54c4d1
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.456 ms) : 0, 1456
crashtracking [candidate] (1.441 ms) : 0, 1441
BytebuddyAgent [baseline] (732.018 ms) : 0, 732018
BytebuddyAgent [candidate] (732.848 ms) : 0, 732848
GlobalTracer [baseline] (252.116 ms) : 0, 252116
GlobalTracer [candidate] (252.496 ms) : 0, 252496
AppSec [baseline] (30.61 ms) : 0, 30610
AppSec [candidate] (30.619 ms) : 0, 30619
Debugger [baseline] (6.392 ms) : 0, 6392
Debugger [candidate] (6.383 ms) : 0, 6383
Remote Config [baseline] (692.127 µs) : 0, 692
Remote Config [candidate] (695.094 µs) : 0, 695
Telemetry [baseline] (15.564 ms) : 0, 15564
Telemetry [candidate] (15.466 ms) : 0, 15466
section iast
crashtracking [baseline] (1.455 ms) : 0, 1455
crashtracking [candidate] (1.452 ms) : 0, 1452
BytebuddyAgent [baseline] (851.14 ms) : 0, 851140
BytebuddyAgent [candidate] (854.33 ms) : 0, 854330
GlobalTracer [baseline] (246.911 ms) : 0, 246911
GlobalTracer [candidate] (248.797 ms) : 0, 248797
AppSec [baseline] (25.349 ms) : 0, 25349
AppSec [candidate] (25.818 ms) : 0, 25818
Debugger [baseline] (6.04 ms) : 0, 6040
Debugger [candidate] (6.121 ms) : 0, 6121
Remote Config [baseline] (592.78 µs) : 0, 593
Remote Config [candidate] (602.687 µs) : 0, 603
Telemetry [baseline] (8.138 ms) : 0, 8138
Telemetry [candidate] (8.357 ms) : 0, 8357
IAST [baseline] (27.93 ms) : 0, 27930
IAST [candidate] (28.275 ms) : 0, 28275
LoadParameters
See matching parameters
SummaryFound 2 performance improvements and 0 performance regressions! Performance is the same for 10 metrics, 12 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~3bca58b0ec, baseline=1.54.0-SNAPSHOT~c68b54c4d1
dateFormat X
axisFormat %s
section baseline
no_agent (37.153 ms) : 36858, 37447
. : milestone, 37153,
appsec (50.137 ms) : 49694, 50580
. : milestone, 50137,
code_origins (45.926 ms) : 45519, 46332
. : milestone, 45926,
iast (44.058 ms) : 43684, 44432
. : milestone, 44058,
profiling (49.44 ms) : 48903, 49977
. : milestone, 49440,
tracing (44.657 ms) : 44273, 45040
. : milestone, 44657,
section candidate
no_agent (38.139 ms) : 37827, 38451
. : milestone, 38139,
appsec (46.809 ms) : 46399, 47219
. : milestone, 46809,
code_origins (44.817 ms) : 44432, 45201
. : milestone, 44817,
iast (44.839 ms) : 44447, 45231
. : milestone, 44839,
profiling (47.965 ms) : 47535, 48395
. : milestone, 47965,
tracing (45.155 ms) : 44767, 45543
. : milestone, 45155,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~3bca58b0ec, baseline=1.54.0-SNAPSHOT~c68b54c4d1
dateFormat X
axisFormat %s
section baseline
no_agent (4.285 ms) : 4236, 4335
. : milestone, 4285,
iast (9.492 ms) : 9336, 9649
. : milestone, 9492,
iast_FULL (14.636 ms) : 14335, 14936
. : milestone, 14636,
iast_GLOBAL (10.941 ms) : 10749, 11134
. : milestone, 10941,
profiling (9.038 ms) : 8888, 9188
. : milestone, 9038,
tracing (7.476 ms) : 7363, 7588
. : milestone, 7476,
section candidate
no_agent (4.402 ms) : 4352, 4451
. : milestone, 4402,
iast (9.579 ms) : 9418, 9741
. : milestone, 9579,
iast_FULL (14.483 ms) : 14191, 14776
. : milestone, 14483,
iast_GLOBAL (9.98 ms) : 9808, 10152
. : milestone, 9980,
profiling (9.081 ms) : 8940, 9222
. : milestone, 9081,
tracing (7.54 ms) : 7436, 7645
. : milestone, 7540,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 1 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.54.0-SNAPSHOT~3bca58b0ec, baseline=1.54.0-SNAPSHOT~c68b54c4d1
dateFormat X
axisFormat %s
section baseline
no_agent (1.474 ms) : 1462, 1485
. : milestone, 1474,
appsec (3.728 ms) : 3513, 3943
. : milestone, 3728,
iast (2.207 ms) : 2144, 2271
. : milestone, 2207,
iast_GLOBAL (2.237 ms) : 2174, 2300
. : milestone, 2237,
profiling (2.064 ms) : 2012, 2116
. : milestone, 2064,
tracing (2.026 ms) : 1977, 2075
. : milestone, 2026,
section candidate
no_agent (1.476 ms) : 1465, 1488
. : milestone, 1476,
appsec (3.715 ms) : 3495, 3936
. : milestone, 3715,
iast (2.201 ms) : 2138, 2264
. : milestone, 2201,
iast_GLOBAL (2.25 ms) : 2186, 2314
. : milestone, 2250,
profiling (2.077 ms) : 2025, 2130
. : milestone, 2077,
tracing (2.041 ms) : 1991, 2090
. : milestone, 2041,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.54.0-SNAPSHOT~3bca58b0ec, baseline=1.54.0-SNAPSHOT~c68b54c4d1
dateFormat X
axisFormat %s
section baseline
no_agent (14.934 s) : 14934000, 14934000
. : milestone, 14934000,
appsec (15.074 s) : 15074000, 15074000
. : milestone, 15074000,
iast (18.731 s) : 18731000, 18731000
. : milestone, 18731000,
iast_GLOBAL (17.969 s) : 17969000, 17969000
. : milestone, 17969000,
profiling (15.94 s) : 15940000, 15940000
. : milestone, 15940000,
tracing (14.854 s) : 14854000, 14854000
. : milestone, 14854000,
section candidate
no_agent (15.752 s) : 15752000, 15752000
. : milestone, 15752000,
appsec (14.848 s) : 14848000, 14848000
. : milestone, 14848000,
iast (18.845 s) : 18845000, 18845000
. : milestone, 18845000,
iast_GLOBAL (18.184 s) : 18184000, 18184000
. : milestone, 18184000,
profiling (15.896 s) : 15896000, 15896000
. : milestone, 15896000,
tracing (15.182 s) : 15182000, 15182000
. : milestone, 15182000,
|
// Helper extension for custom method from Groovy DSL | ||
fun addTestSuiteForDir(name: String, dirName: String) { | ||
(project.extra["addTestSuiteForDir"] as? Closure<*>)?.call(name, dirName) | ||
} | ||
|
||
addTestSuiteForDir("latestDepTest", "test") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably Kotlin alternative should be something like:
plugins {
id("org.unbroken-dome.test-sets") version "4.1.0"
}
testSets {
create("latestDepTest") {
dirName = "test"
}
}
See: https://github.com/unbroken-dome/gradle-testsets-plugin
Here and other similar places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlexeyKuznetsov-DD That's an interesting plugin, but I'd rather hold until we have a discussion on conventions plugins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for going into this topic.
I believe you discovered the first issues with this challenging task. 😅
"iastIntegrationTestImplementation"(project(":dd-java-agent:agent-iast:iast-test-fixtures")) | ||
"iastIntegrationTestImplementation"("org.apache.httpcomponents:httpclient:4.0") | ||
"iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:jetty:jetty-server:jetty-server-9.0")) | ||
"iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:apache-httpcore:apache-httpcore-4.0")) | ||
"iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:servlet")) | ||
"iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:java-lang")) | ||
"iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:java-net")) | ||
"iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:iast-instrumenter")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: This code is an example of the kotlin's invoke operator:
Parentheses are translated to calls to
invoke
with appropriate number of arguments.
So
"iastIntegrationTestRuntimeOnly"(project(":dd-java-agent:instrumentation:iast-instrumenter"))
is actually :
"iastIntegrationTestRuntimeOnly".invoke(project(":dd-java-agent:instrumentation:iast-instrumenter"))
which is nice since it allows you to see the method, and access its definition and javadoc.
Also, note that since String
s doesn't have .invoke
operators, it has to be an extension function on a String
. On a personal note I think having the invoke operator on String
(this is a Gradle API) is a bit scabrous, and I would prefer the more explicit way :
add("iastIntegrationTestRuntimeOnly", project(":dd-java-agent:instrumentation:iast-instrumenter"))
// Helper extension for custom method from Groovy DSL | ||
fun addTestSuiteForDir(name: String, dirName: String) { | ||
(project.extra["addTestSuiteForDir"] as? Closure<*>)?.call(name, dirName) | ||
} | ||
|
||
addTestSuiteForDir("latestDepTest", "test") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlexeyKuznetsov-DD That's an interesting plugin, but I'd rather hold until we have a discussion on conventions plugins.
// Helper extensions for custom methods from Groovy DSL | ||
fun addTestSuite(name: String) { | ||
(project.extra["addTestSuite"] as? Closure<*>)?.call(name) | ||
} | ||
fun addTestSuiteForDir(name: String, dirName: String) { | ||
(project.extra["addTestSuiteForDir"] as? Closure<*>)?.call(name, dirName) | ||
} | ||
fun addTestSuiteExtendingForDir(testSuiteName: String, parentSuiteName: String, dirName: String) { | ||
(project.extra["addTestSuiteExtendingForDir"] as? Closure<*>)?.call(testSuiteName, parentSuiteName, dirName) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Having these is actually why I'm holding off on migrating every build gradle to kotlin.
That doesn't mean it shouldn't happen there as now we have an example of some pain points.
Ideally, our test-suites.gradle
script should be a convention plugin, that is applied as part of the declaration of the plugins { }
block at the beginning of the build script.
[!NOTE] When Gradle parses the build scripts it processes the
plugins {}
block first, and can safely inject "accessors" to the classpath of this build script where the methods of the convention plugin are.
Gradle can't do that with script plugins.
E.g.g this comment // Kotlin accessors are not generated if not created by a plugin or explicitly declared
is exactly about that.
=> Now as I'm mentioning convention plugins, the idea is to identify conventions and name them, for example instrumenqation projects could have a convention plugin datadog.instrumentation-project
, and this plugin should:
- apply other plugins as necessary,
- configure them
- add and extensions as needed (methods or configuration constructs)
Everything ./gradle/*.gradle
should land in a convention plugin in some form.
Resources:
- https://docs.gradle.org/8.14.3/userguide/plugins.html#1_script_plugins (using the
apply from:
syntax) - https://docs.gradle.org/8.14.3/userguide/plugins.html#sec:old_plugin_application
Note those link are referring to the 8.14.3, but script plugins are barely mentioned in Gradle 9, apart that they are not recommended, meaning it's likely Gradle will phase out these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, thanks for all of the context!
What Does This Do
Update the
build.gradle
files for apache-http* instrumentations to kotlinMotivation
Slowly upgrade our build
Additional Notes
I based a few changes in this PR off of #9103... Thanks @bric3 !
Contributor Checklist
type:
and (comp:
orinst:
) labels in addition to any usefull labelsclose
,fix
or any linking keywords when referencing an issue.Use
solves
instead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]