-
Notifications
You must be signed in to change notification settings - Fork 312
Adding Gradle Plugins for Config Inversion #9565
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
Conversation
🎯 Code Coverage 🔗 Commit SHA: d30ad8f | Docs | Was this helpful? Give us feedback! |
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 55 metrics, 4 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.54.0-SNAPSHOT~d30ad8f427, baseline=1.54.0-SNAPSHOT~e992b65c80
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.004 s) : 0, 1004277
Total [baseline] (8.652 s) : 0, 8652436
Agent [candidate] (1.003 s) : 0, 1002570
Total [candidate] (8.656 s) : 0, 8655626
section iast
Agent [baseline] (1.151 s) : 0, 1151483
Total [baseline] (9.334 s) : 0, 9334097
Agent [candidate] (1.144 s) : 0, 1144142
Total [candidate] (9.29 s) : 0, 9290346
gantt
title insecure-bank - break down per module: candidate=1.54.0-SNAPSHOT~d30ad8f427, baseline=1.54.0-SNAPSHOT~e992b65c80
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.456 ms) : 0, 1456
crashtracking [candidate] (1.46 ms) : 0, 1460
BytebuddyAgent [baseline] (687.085 ms) : 0, 687085
BytebuddyAgent [candidate] (685.09 ms) : 0, 685090
GlobalTracer [baseline] (247.523 ms) : 0, 247523
GlobalTracer [candidate] (247.894 ms) : 0, 247894
AppSec [baseline] (30.946 ms) : 0, 30946
AppSec [candidate] (30.967 ms) : 0, 30967
Debugger [baseline] (6.368 ms) : 0, 6368
Debugger [candidate] (6.321 ms) : 0, 6321
Remote Config [baseline] (680.49 µs) : 0, 680
Remote Config [candidate] (678.085 µs) : 0, 678
Telemetry [baseline] (9.063 ms) : 0, 9063
Telemetry [candidate] (9.043 ms) : 0, 9043
section iast
crashtracking [baseline] (1.488 ms) : 0, 1488
crashtracking [candidate] (1.458 ms) : 0, 1458
BytebuddyAgent [baseline] (815.173 ms) : 0, 815173
BytebuddyAgent [candidate] (808.989 ms) : 0, 808989
GlobalTracer [baseline] (238.997 ms) : 0, 238997
GlobalTracer [candidate] (238.062 ms) : 0, 238062
AppSec [baseline] (33.69 ms) : 0, 33690
AppSec [candidate] (33.438 ms) : 0, 33438
Debugger [baseline] (6.029 ms) : 0, 6029
Debugger [candidate] (6.09 ms) : 0, 6090
Remote Config [baseline] (592.605 µs) : 0, 593
Remote Config [candidate] (587.656 µs) : 0, 588
Telemetry [baseline] (8.288 ms) : 0, 8288
Telemetry [candidate] (8.225 ms) : 0, 8225
IAST [baseline] (25.966 ms) : 0, 25966
IAST [candidate] (26.002 ms) : 0, 26002
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.54.0-SNAPSHOT~d30ad8f427, baseline=1.54.0-SNAPSHOT~e992b65c80
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.004 s) : 0, 1004286
Total [baseline] (10.716 s) : 0, 10716348
Agent [candidate] (1.003 s) : 0, 1002612
Total [candidate] (10.755 s) : 0, 10755051
section appsec
Agent [baseline] (1.185 s) : 0, 1185437
Total [baseline] (11.043 s) : 0, 11043087
Agent [candidate] (1.184 s) : 0, 1183574
Total [candidate] (11.017 s) : 0, 11016919
section iast
Agent [baseline] (1.144 s) : 0, 1144478
Total [baseline] (10.878 s) : 0, 10877826
Agent [candidate] (1.14 s) : 0, 1139889
Total [candidate] (10.938 s) : 0, 10938360
section profiling
Agent [baseline] (1.16 s) : 0, 1159965
Total [baseline] (11.024 s) : 0, 11024277
Agent [candidate] (1.153 s) : 0, 1153158
Total [candidate] (11.034 s) : 0, 11034201
gantt
title petclinic - break down per module: candidate=1.54.0-SNAPSHOT~d30ad8f427, baseline=1.54.0-SNAPSHOT~e992b65c80
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.459 ms) : 0, 1459
crashtracking [candidate] (1.461 ms) : 0, 1461
BytebuddyAgent [baseline] (687.131 ms) : 0, 687131
BytebuddyAgent [candidate] (685.054 ms) : 0, 685054
GlobalTracer [baseline] (247.404 ms) : 0, 247404
GlobalTracer [candidate] (247.709 ms) : 0, 247709
AppSec [baseline] (31.145 ms) : 0, 31145
AppSec [candidate] (31.239 ms) : 0, 31239
Debugger [baseline] (6.329 ms) : 0, 6329
Debugger [candidate] (6.284 ms) : 0, 6284
Remote Config [baseline] (685.352 µs) : 0, 685
Remote Config [candidate] (670.16 µs) : 0, 670
Telemetry [baseline] (8.926 ms) : 0, 8926
Telemetry [candidate] (9.005 ms) : 0, 9005
section appsec
crashtracking [baseline] (1.456 ms) : 0, 1456
crashtracking [candidate] (1.446 ms) : 0, 1446
BytebuddyAgent [baseline] (710.106 ms) : 0, 710106
BytebuddyAgent [candidate] (709.424 ms) : 0, 709424
GlobalTracer [baseline] (239.534 ms) : 0, 239534
GlobalTracer [candidate] (239.322 ms) : 0, 239322
AppSec [baseline] (172.37 ms) : 0, 172370
AppSec [candidate] (170.993 ms) : 0, 170993
Debugger [baseline] (5.982 ms) : 0, 5982
Debugger [candidate] (6.759 ms) : 0, 6759
Remote Config [baseline] (626.511 µs) : 0, 627
Remote Config [candidate] (627.067 µs) : 0, 627
Telemetry [baseline] (9.274 ms) : 0, 9274
Telemetry [candidate] (9.127 ms) : 0, 9127
IAST [baseline] (24.884 ms) : 0, 24884
IAST [candidate] (24.702 ms) : 0, 24702
section iast
crashtracking [baseline] (1.456 ms) : 0, 1456
crashtracking [candidate] (1.459 ms) : 0, 1459
BytebuddyAgent [baseline] (808.714 ms) : 0, 808714
BytebuddyAgent [candidate] (805.786 ms) : 0, 805786
GlobalTracer [baseline] (238.073 ms) : 0, 238073
GlobalTracer [candidate] (237.145 ms) : 0, 237145
AppSec [baseline] (33.959 ms) : 0, 33959
AppSec [candidate] (33.398 ms) : 0, 33398
Debugger [baseline] (6.048 ms) : 0, 6048
Debugger [candidate] (6.061 ms) : 0, 6061
Remote Config [baseline] (595.676 µs) : 0, 596
Remote Config [candidate] (592.374 µs) : 0, 592
Telemetry [baseline] (8.239 ms) : 0, 8239
Telemetry [candidate] (8.196 ms) : 0, 8196
IAST [baseline] (26.056 ms) : 0, 26056
IAST [candidate] (25.955 ms) : 0, 25955
section profiling
crashtracking [baseline] (1.445 ms) : 0, 1445
crashtracking [candidate] (1.438 ms) : 0, 1438
BytebuddyAgent [baseline] (723.988 ms) : 0, 723988
BytebuddyAgent [candidate] (719.793 ms) : 0, 719793
GlobalTracer [baseline] (225.783 ms) : 0, 225783
GlobalTracer [candidate] (224.163 ms) : 0, 224163
AppSec [baseline] (31.552 ms) : 0, 31552
AppSec [candidate] (31.429 ms) : 0, 31429
Debugger [baseline] (8.139 ms) : 0, 8139
Debugger [candidate] (7.265 ms) : 0, 7265
Remote Config [baseline] (707.685 µs) : 0, 708
Remote Config [candidate] (713.687 µs) : 0, 714
Telemetry [baseline] (14.682 ms) : 0, 14682
Telemetry [candidate] (15.615 ms) : 0, 15615
ProfilingAgent [baseline] (102.177 ms) : 0, 102177
ProfilingAgent [candidate] (101.726 ms) : 0, 101726
Profiling [baseline] (102.767 ms) : 0, 102767
Profiling [candidate] (102.319 ms) : 0, 102319
LoadParameters
See matching parameters
SummaryFound 4 performance improvements and 1 performance regressions! Performance is the same for 7 metrics, 12 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~d30ad8f427, baseline=1.54.0-SNAPSHOT~e992b65c80
dateFormat X
axisFormat %s
section baseline
no_agent (38.64 ms) : 38321, 38959
. : milestone, 38640,
appsec (47.442 ms) : 47039, 47844
. : milestone, 47442,
code_origins (44.368 ms) : 43979, 44756
. : milestone, 44368,
iast (46.544 ms) : 46134, 46955
. : milestone, 46544,
profiling (47.832 ms) : 47385, 48279
. : milestone, 47832,
tracing (45.954 ms) : 45562, 46347
. : milestone, 45954,
section candidate
no_agent (36.175 ms) : 35886, 36464
. : milestone, 36175,
appsec (49.48 ms) : 49058, 49902
. : milestone, 49480,
code_origins (45.045 ms) : 44647, 45443
. : milestone, 45045,
iast (45.247 ms) : 44862, 45632
. : milestone, 45247,
profiling (47.3 ms) : 46861, 47739
. : milestone, 47300,
tracing (44.47 ms) : 44072, 44867
. : milestone, 44470,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~d30ad8f427, baseline=1.54.0-SNAPSHOT~e992b65c80
dateFormat X
axisFormat %s
section baseline
no_agent (4.406 ms) : 4350, 4461
. : milestone, 4406,
iast (9.967 ms) : 9794, 10140
. : milestone, 9967,
iast_FULL (13.979 ms) : 13704, 14254
. : milestone, 13979,
iast_GLOBAL (10.493 ms) : 10308, 10678
. : milestone, 10493,
profiling (9.387 ms) : 9215, 9559
. : milestone, 9387,
tracing (7.992 ms) : 7873, 8110
. : milestone, 7992,
section candidate
no_agent (4.364 ms) : 4308, 4420
. : milestone, 4364,
iast (9.351 ms) : 9200, 9503
. : milestone, 9351,
iast_FULL (14.541 ms) : 14246, 14837
. : milestone, 14541,
iast_GLOBAL (10.474 ms) : 10277, 10671
. : milestone, 10474,
profiling (9.053 ms) : 8899, 9207
. : milestone, 9053,
tracing (7.657 ms) : 7542, 7773
. : milestone, 7657,
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~d30ad8f427, baseline=1.54.0-SNAPSHOT~e992b65c80
dateFormat X
axisFormat %s
section baseline
no_agent (1.473 ms) : 1461, 1484
. : milestone, 1473,
appsec (2.506 ms) : 2453, 2559
. : milestone, 2506,
iast (2.194 ms) : 2131, 2257
. : milestone, 2194,
iast_GLOBAL (2.259 ms) : 2195, 2323
. : milestone, 2259,
profiling (2.054 ms) : 2003, 2104
. : milestone, 2054,
tracing (2.012 ms) : 1963, 2061
. : milestone, 2012,
section candidate
no_agent (1.477 ms) : 1466, 1489
. : milestone, 1477,
appsec (3.713 ms) : 3493, 3934
. : milestone, 3713,
iast (2.202 ms) : 2139, 2265
. : milestone, 2202,
iast_GLOBAL (2.256 ms) : 2192, 2320
. : milestone, 2256,
profiling (2.04 ms) : 1989, 2091
. : milestone, 2040,
tracing (2.023 ms) : 1974, 2073
. : milestone, 2023,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.54.0-SNAPSHOT~d30ad8f427, baseline=1.54.0-SNAPSHOT~e992b65c80
dateFormat X
axisFormat %s
section baseline
no_agent (14.989 s) : 14989000, 14989000
. : milestone, 14989000,
appsec (15.247 s) : 15247000, 15247000
. : milestone, 15247000,
iast (18.54 s) : 18540000, 18540000
. : milestone, 18540000,
iast_GLOBAL (18.079 s) : 18079000, 18079000
. : milestone, 18079000,
profiling (15.304 s) : 15304000, 15304000
. : milestone, 15304000,
tracing (14.942 s) : 14942000, 14942000
. : milestone, 14942000,
section candidate
no_agent (15.484 s) : 15484000, 15484000
. : milestone, 15484000,
appsec (15.134 s) : 15134000, 15134000
. : milestone, 15134000,
iast (18.54 s) : 18540000, 18540000
. : milestone, 18540000,
iast_GLOBAL (17.913 s) : 17913000, 17913000
. : milestone, 17913000,
profiling (16.077 s) : 16077000, 16077000
. : milestone, 16077000,
tracing (14.941 s) : 14941000, 14941000
. : milestone, 14941000,
|
|
||
PrintWriter(outFile).use { out -> | ||
// NOTE: adjust these if you want to match task's className | ||
out.println("package $packageName;") |
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.
🎯 suggestion: I would recommend using Kotlin multiline strings for readability.
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.
polish: There's also the buildString { }
but that's basically some sugar around a StringBuilder
. The multiline, looks like a nice improvement. But could be done in a follow-up.
@@ -1,5 +1,6 @@ | |||
plugins { | |||
`java-library` | |||
id("supported-config-generator") |
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: Just some tip about kotlin-dsl, it also possible to refer to that plugin with the generated accessor supported-config-generator
which is exactly the same as id("supported-config-generator")
.
Note this code is fine and you can close the comment.
val supported: Set<String> = URLClassLoader(urls, javaClass.classLoader).use { cl -> | ||
// 2) Load the generated class + read static field | ||
val clazz = Class.forName(generatedFile.get(), true, cl) | ||
@Suppress("UNCHECKED_CAST") | ||
clazz.getField("SUPPORTED").get(null) as Set<String> | ||
} |
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.
thought: I believe this might be more efficient to parse the json file rather than wait for generatedFile
(actually a generatedClass
) to be compiled.
buildSrc/src/main/kotlin/datadog/gradle/plugin/config/ConfigInversionLinter.kt
Outdated
Show resolved
Hide resolved
buildSrc/src/main/kotlin/datadog/gradle/plugin/config/ConfigInversionLinter.kt
Outdated
Show resolved
Hide resolved
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.
Looks good already, but I'm unsure about the exclude pattern.
Other comments can be addressed in a later PR.
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.
Let's go with the current implementation! Thanks for this job!
What Does This Do
This PR implements the basic Gradle plugins for Config Inversion.
Components:
ParseSupportedConfigurationsTask
&GeneratedSupportedConfigurations.java
supported-configurations.json
at build-time and stores the values in a static fileGeneratedSupportedConfigurations.java
DD_FOO_BAR
)EnvironmentVariables.get()
andEnvironmentVariables.getAll()
. This is to encourage the usage ofConfigHelper
to enforce the documentation of unknown environment variables.Motivation
Additional Notes
Follow-up to
Next ones
ConfigInversionMetricCollector
toconfig-utils
module #9566Warning
#9539Contributor 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]