-
Notifications
You must be signed in to change notification settings - Fork 320
Implement Config Inversion with Default Strictness of Warning
#9539
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
1a576ea to
512b2c6
Compare
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 58 metrics, 7 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.55.0-SNAPSHOT~7a2f0c58e0, baseline=1.55.0-SNAPSHOT~ef27983a1d
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.016 s) : 0, 1016349
Total [baseline] (10.773 s) : 0, 10773322
Agent [candidate] (1.019 s) : 0, 1019144
Total [candidate] (10.683 s) : 0, 10682801
section appsec
Agent [baseline] (1.194 s) : 0, 1193834
Total [baseline] (10.92 s) : 0, 10920118
Agent [candidate] (1.191 s) : 0, 1190686
Total [candidate] (11.041 s) : 0, 11041316
section iast
Agent [baseline] (1.15 s) : 0, 1149514
Total [baseline] (11.016 s) : 0, 11016186
Agent [candidate] (1.16 s) : 0, 1159601
Total [candidate] (11.101 s) : 0, 11100945
section profiling
Agent [baseline] (1.16 s) : 0, 1159603
Total [baseline] (11.031 s) : 0, 11031443
Agent [candidate] (1.169 s) : 0, 1168882
Total [candidate] (11.035 s) : 0, 11035434
gantt
title petclinic - break down per module: candidate=1.55.0-SNAPSHOT~7a2f0c58e0, baseline=1.55.0-SNAPSHOT~ef27983a1d
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.458 ms) : 0, 1458
crashtracking [candidate] (1.459 ms) : 0, 1459
BytebuddyAgent [baseline] (694.41 ms) : 0, 694410
BytebuddyAgent [candidate] (694.99 ms) : 0, 694990
GlobalTracer [baseline] (241.558 ms) : 0, 241558
GlobalTracer [candidate] (242.122 ms) : 0, 242122
AppSec [baseline] (32.567 ms) : 0, 32567
AppSec [candidate] (32.513 ms) : 0, 32513
Debugger [baseline] (6.464 ms) : 0, 6464
Debugger [candidate] (6.442 ms) : 0, 6442
Remote Config [baseline] (711.36 µs) : 0, 711
Remote Config [candidate] (698.445 µs) : 0, 698
Telemetry [baseline] (9.278 ms) : 0, 9278
Telemetry [candidate] (9.328 ms) : 0, 9328
Flare Poller [baseline] (8.719 ms) : 0, 8719
Flare Poller [candidate] (10.313 ms) : 0, 10313
section appsec
crashtracking [baseline] (1.451 ms) : 0, 1451
crashtracking [candidate] (1.441 ms) : 0, 1441
BytebuddyAgent [baseline] (718.109 ms) : 0, 718109
BytebuddyAgent [candidate] (715.687 ms) : 0, 715687
GlobalTracer [baseline] (234.54 ms) : 0, 234540
GlobalTracer [candidate] (233.755 ms) : 0, 233755
IAST [baseline] (24.673 ms) : 0, 24673
IAST [candidate] (24.819 ms) : 0, 24819
AppSec [baseline] (174.894 ms) : 0, 174894
AppSec [candidate] (174.949 ms) : 0, 174949
Debugger [baseline] (6.088 ms) : 0, 6088
Debugger [candidate] (6.076 ms) : 0, 6076
Remote Config [baseline] (622.803 µs) : 0, 623
Remote Config [candidate] (621.699 µs) : 0, 622
Telemetry [baseline] (8.437 ms) : 0, 8437
Telemetry [candidate] (8.397 ms) : 0, 8397
Flare Poller [baseline] (3.902 ms) : 0, 3902
Flare Poller [candidate] (3.917 ms) : 0, 3917
section iast
crashtracking [baseline] (1.458 ms) : 0, 1458
crashtracking [candidate] (1.463 ms) : 0, 1463
BytebuddyAgent [baseline] (814.35 ms) : 0, 814350
BytebuddyAgent [candidate] (820.643 ms) : 0, 820643
GlobalTracer [baseline] (231.015 ms) : 0, 231015
GlobalTracer [candidate] (233.101 ms) : 0, 233101
IAST [baseline] (26.38 ms) : 0, 26380
IAST [candidate] (26.95 ms) : 0, 26950
AppSec [baseline] (35.18 ms) : 0, 35180
AppSec [candidate] (35.767 ms) : 0, 35767
Debugger [baseline] (6.128 ms) : 0, 6128
Debugger [candidate] (6.264 ms) : 0, 6264
Remote Config [baseline] (604.896 µs) : 0, 605
Remote Config [candidate] (632.47 µs) : 0, 632
Telemetry [baseline] (8.601 ms) : 0, 8601
Telemetry [candidate] (8.799 ms) : 0, 8799
Flare Poller [baseline] (4.289 ms) : 0, 4289
Flare Poller [candidate] (4.255 ms) : 0, 4255
section profiling
crashtracking [baseline] (1.427 ms) : 0, 1427
crashtracking [candidate] (1.438 ms) : 0, 1438
BytebuddyAgent [baseline] (720.252 ms) : 0, 720252
BytebuddyAgent [candidate] (726.059 ms) : 0, 726059
GlobalTracer [baseline] (217.437 ms) : 0, 217437
GlobalTracer [candidate] (218.588 ms) : 0, 218588
AppSec [baseline] (32.364 ms) : 0, 32364
AppSec [candidate] (32.715 ms) : 0, 32715
Debugger [baseline] (6.523 ms) : 0, 6523
Debugger [candidate] (7.329 ms) : 0, 7329
Remote Config [baseline] (748.208 µs) : 0, 748
Remote Config [candidate] (867.981 µs) : 0, 868
Telemetry [baseline] (16.216 ms) : 0, 16216
Telemetry [candidate] (15.262 ms) : 0, 15262
Flare Poller [baseline] (4.148 ms) : 0, 4148
Flare Poller [candidate] (4.148 ms) : 0, 4148
ProfilingAgent [baseline] (107.853 ms) : 0, 107853
ProfilingAgent [candidate] (109.085 ms) : 0, 109085
Profiling [baseline] (108.596 ms) : 0, 108596
Profiling [candidate] (110.083 ms) : 0, 110083
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.55.0-SNAPSHOT~7a2f0c58e0, baseline=1.55.0-SNAPSHOT~ef27983a1d
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.015 s) : 0, 1014619
Total [baseline] (8.702 s) : 0, 8701670
Agent [candidate] (1.025 s) : 0, 1025305
Total [candidate] (8.732 s) : 0, 8732332
section iast
Agent [baseline] (1.148 s) : 0, 1148164
Total [baseline] (9.252 s) : 0, 9252101
Agent [candidate] (1.151 s) : 0, 1151353
Total [candidate] (9.269 s) : 0, 9268895
gantt
title insecure-bank - break down per module: candidate=1.55.0-SNAPSHOT~7a2f0c58e0, baseline=1.55.0-SNAPSHOT~ef27983a1d
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.451 ms) : 0, 1451
crashtracking [candidate] (1.476 ms) : 0, 1476
BytebuddyAgent [baseline] (691.629 ms) : 0, 691629
BytebuddyAgent [candidate] (698.84 ms) : 0, 698840
GlobalTracer [baseline] (242.161 ms) : 0, 242161
GlobalTracer [candidate] (243.821 ms) : 0, 243821
AppSec [baseline] (32.767 ms) : 0, 32767
AppSec [candidate] (33.028 ms) : 0, 33028
Debugger [baseline] (6.448 ms) : 0, 6448
Debugger [candidate] (6.592 ms) : 0, 6592
Remote Config [baseline] (704.521 µs) : 0, 705
Remote Config [candidate] (704.199 µs) : 0, 704
Telemetry [baseline] (9.296 ms) : 0, 9296
Telemetry [candidate] (9.426 ms) : 0, 9426
Flare Poller [baseline] (8.99 ms) : 0, 8990
Flare Poller [candidate] (10.217 ms) : 0, 10217
section iast
crashtracking [baseline] (1.488 ms) : 0, 1488
crashtracking [candidate] (1.481 ms) : 0, 1481
BytebuddyAgent [baseline] (813.52 ms) : 0, 813520
BytebuddyAgent [candidate] (816.241 ms) : 0, 816241
GlobalTracer [baseline] (230.318 ms) : 0, 230318
GlobalTracer [candidate] (231.107 ms) : 0, 231107
IAST [baseline] (26.331 ms) : 0, 26331
IAST [candidate] (27.362 ms) : 0, 27362
AppSec [baseline] (35.366 ms) : 0, 35366
AppSec [candidate] (34.017 ms) : 0, 34017
Debugger [baseline] (6.149 ms) : 0, 6149
Debugger [candidate] (6.168 ms) : 0, 6168
Remote Config [baseline] (601.847 µs) : 0, 602
Remote Config [candidate] (615.614 µs) : 0, 616
Telemetry [baseline] (8.644 ms) : 0, 8644
Telemetry [candidate] (8.684 ms) : 0, 8684
Flare Poller [baseline] (4.251 ms) : 0, 4251
Flare Poller [candidate] (4.163 ms) : 0, 4163
LoadParameters
See matching parameters
SummaryFound 1 performance improvements and 2 performance regressions! Performance is the same for 9 metrics, 12 unstable metrics.
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.55.0-SNAPSHOT~7a2f0c58e0, baseline=1.55.0-SNAPSHOT~ef27983a1d
dateFormat X
axisFormat %s
section baseline
no_agent (4.355 ms) : 4306, 4403
. : milestone, 4355,
iast (9.488 ms) : 9330, 9646
. : milestone, 9488,
iast_FULL (14.323 ms) : 14037, 14608
. : milestone, 14323,
iast_GLOBAL (10.226 ms) : 10048, 10404
. : milestone, 10226,
profiling (8.846 ms) : 8700, 8992
. : milestone, 8846,
tracing (7.912 ms) : 7789, 8035
. : milestone, 7912,
section candidate
no_agent (4.507 ms) : 4449, 4565
. : milestone, 4507,
iast (9.604 ms) : 9436, 9771
. : milestone, 9604,
iast_FULL (14.064 ms) : 13783, 14346
. : milestone, 14064,
iast_GLOBAL (10.995 ms) : 10799, 11191
. : milestone, 10995,
profiling (9.092 ms) : 8950, 9234
. : milestone, 9092,
tracing (7.884 ms) : 7770, 7997
. : milestone, 7884,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.55.0-SNAPSHOT~7a2f0c58e0, baseline=1.55.0-SNAPSHOT~ef27983a1d
dateFormat X
axisFormat %s
section baseline
no_agent (37.236 ms) : 36935, 37537
. : milestone, 37236,
appsec (46.619 ms) : 46203, 47034
. : milestone, 46619,
code_origins (43.749 ms) : 43378, 44119
. : milestone, 43749,
iast (44.936 ms) : 44541, 45331
. : milestone, 44936,
profiling (49.396 ms) : 48930, 49863
. : milestone, 49396,
tracing (43.251 ms) : 42878, 43623
. : milestone, 43251,
section candidate
no_agent (36.417 ms) : 36127, 36707
. : milestone, 36417,
appsec (47.444 ms) : 47022, 47865
. : milestone, 47444,
code_origins (44.719 ms) : 44323, 45116
. : milestone, 44719,
iast (45.064 ms) : 44671, 45458
. : milestone, 45064,
profiling (47.601 ms) : 47119, 48083
. : milestone, 47601,
tracing (44.133 ms) : 43759, 44508
. : milestone, 44133,
DacapoParameters
See matching parameters
SummaryFound 1 performance improvements and 0 performance regressions! Performance is the same for 10 metrics, 1 unstable metrics.
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.55.0-SNAPSHOT~7a2f0c58e0, baseline=1.55.0-SNAPSHOT~ef27983a1d
dateFormat X
axisFormat %s
section baseline
no_agent (15.657 s) : 15657000, 15657000
. : milestone, 15657000,
appsec (14.998 s) : 14998000, 14998000
. : milestone, 14998000,
iast (18.704 s) : 18704000, 18704000
. : milestone, 18704000,
iast_GLOBAL (17.818 s) : 17818000, 17818000
. : milestone, 17818000,
profiling (15.595 s) : 15595000, 15595000
. : milestone, 15595000,
tracing (14.854 s) : 14854000, 14854000
. : milestone, 14854000,
section candidate
no_agent (14.774 s) : 14774000, 14774000
. : milestone, 14774000,
appsec (14.803 s) : 14803000, 14803000
. : milestone, 14803000,
iast (18.58 s) : 18580000, 18580000
. : milestone, 18580000,
iast_GLOBAL (17.909 s) : 17909000, 17909000
. : milestone, 17909000,
profiling (15.272 s) : 15272000, 15272000
. : milestone, 15272000,
tracing (15.279 s) : 15279000, 15279000
. : milestone, 15279000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.55.0-SNAPSHOT~7a2f0c58e0, baseline=1.55.0-SNAPSHOT~ef27983a1d
dateFormat X
axisFormat %s
section baseline
no_agent (1.48 ms) : 1469, 1492
. : milestone, 1480,
appsec (3.674 ms) : 3462, 3887
. : milestone, 3674,
iast (2.221 ms) : 2157, 2284
. : milestone, 2221,
iast_GLOBAL (2.277 ms) : 2212, 2341
. : milestone, 2277,
profiling (2.09 ms) : 2037, 2144
. : milestone, 2090,
tracing (2.045 ms) : 1995, 2096
. : milestone, 2045,
section candidate
no_agent (1.48 ms) : 1469, 1492
. : milestone, 1480,
appsec (2.518 ms) : 2464, 2572
. : milestone, 2518,
iast (2.222 ms) : 2159, 2286
. : milestone, 2222,
iast_GLOBAL (2.257 ms) : 2193, 2321
. : milestone, 2257,
profiling (2.521 ms) : 2352, 2689
. : milestone, 2521,
tracing (2.037 ms) : 1987, 2087
. : milestone, 2037,
|
|
🎯 Code Coverage 🔗 Commit SHA: 7a2f0c5 | Docs | Was this helpful? Give us feedback! |
Warning
|
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
aa18112 to
606dfd0
Compare
606dfd0 to
7cea99b
Compare
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.
👏 praise: Thanks for splitting the PR related to your config changes, that really helps to review 👍
🎯 suggestion: I would recommend trying to decrease the overall (cognitive) complexity by refactoring using new few methods to de-duplicate code and give more meaning.
For example this should have its own function with a meaningful name:
if (key.startsWith("DD_")
|| key.startsWith("OTEL_")
|| configSource.getAliasMapping().containsKey(key))
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Show resolved
Hide resolved
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigInversionStrictStyle.java
Outdated
Show resolved
Hide resolved
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Outdated
Show resolved
Hide resolved
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Outdated
Show resolved
Hide resolved
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Outdated
Show resolved
Hide resolved
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Outdated
Show resolved
Hide resolved
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Outdated
Show resolved
Hide resolved
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigInversionStrictStyle.java
Outdated
Show resolved
Hide resolved
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Outdated
Show resolved
Hide resolved
57483a2 to
1574d9b
Compare
a20edf0 to
bb4f47c
Compare
AlexeyKuznetsov-DD
left a comment
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.
Left some notes and questions.
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Outdated
Show resolved
Hide resolved
| configs.put(key, value); | ||
| // If this environment variable is the alias of another, and we haven't processed the | ||
| // original environment variable yet, handle it here. | ||
| } else if (null != primaryEnv && !configs.containsKey(primaryEnv)) { |
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.
Are we OK with Yoda style? Here and other similar places.
Maybe natural way is better or more human: primaryEnv != null, WDYT?
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.
I remember in a previous PR, I was told that there was some benefit to doing Yoda style, but that may be for a different context. I can't find the old comment but I can reverse the ordering here 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.
it is not strict request, can you search code base to get some stats?
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.
I did a quick search on GitHub, instances of != null and == null vs null != and null == seem to be very comparable 🤷♂️
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.
I was told that there was some benefit to doing Yoda style
in C++, not in Java
see https://jpbempel.github.io/2015/09/21/yoda-conditions.html for more rationale
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Outdated
Show resolved
Hide resolved
| // Cache for configs, init value is null | ||
| private Map<String, String> configs; |
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.
Just thinking out loud: do we need null state? Maybe empty map will be better? No null checks in usages? WDYT?
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.
I think we can use empty map instead. Here is my thought process:
The only situation where initializing configs as null would be better is when no env vars are set at all, since our cache would have the same effect as if we had not yet processed env vars. This is a very improbable situation since we expect customers to set env vars, so I'm happy to change to initializing to an empty map.
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.
Actually, I learned that Collections.emptyMap() is a EmptyMap type, which is different than an empty HashMap. There is no reason to not use it here :)
…adability and hide supported-configuration details
… ControllableEnvironmentVariables
63e5d5a to
a257e6c
Compare
What Does This Do
This PR implements basic Config Inversion, aiming to document all DD/OTEL environment variables used in the repo in a
supported-configurations.jsonfile.Components:
ConfigInversionStrictStyle.javaStrictwhich does not allow any usage of an unknown DD/OTEL environment variable,Warningwhich allows the usage but sends telemetry about unknown environment variables, andTestwhich allows the usage of unknown environment variables without sending telemetry.WarningConfigHelper.javasupported-configurations.jsonto ensure the environment variable queried for is "known"ConfigInversionStrictStylethat is set.Motivation
This PR supports the general Config Inversion theme that has already been implemented in dd-trace-js and currently being implemented in dd-trace-go and dd-trace-rb. Here is the RFC that documents what this project entails.
Additional Notes
This is a follow-up to
ConfigInversionMetricCollectortoconfig-utilsmodule #9566Contributor Checklist
type:and (comp:orinst:) labels in addition to any usefull labelsclose,fixor any linking keywords when referencing an issue.Use
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]