-
Notifications
You must be signed in to change notification settings - Fork 312
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
base: mhlidd/test
Are you sure you want to change the base?
Conversation
1a576ea
to
512b2c6
Compare
BenchmarksStartupParameters
See matching parameters
SummaryFound 6 performance improvements and 2 performance regressions! Performance is the same for 47 metrics, 4 unstable metrics.
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.54.0-SNAPSHOT~63e5d5a068, baseline=1.55.0-SNAPSHOT~37454135e4
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.025 s) : 0, 1024585
Total [baseline] (10.76 s) : 0, 10759911
Agent [candidate] (1.008 s) : 0, 1007614
Total [candidate] (10.704 s) : 0, 10703905
section appsec
Agent [baseline] (1.193 s) : 0, 1193394
Total [baseline] (11.033 s) : 0, 11032662
Agent [candidate] (1.187 s) : 0, 1186537
Total [candidate] (11.041 s) : 0, 11040552
section iast
Agent [baseline] (1.154 s) : 0, 1154060
Total [baseline] (10.922 s) : 0, 10922123
Agent [candidate] (1.146 s) : 0, 1145890
Total [candidate] (10.961 s) : 0, 10961143
section profiling
Agent [baseline] (1.16 s) : 0, 1159753
Total [baseline] (11.079 s) : 0, 11079321
Agent [candidate] (1.154 s) : 0, 1154347
Total [candidate] (11.07 s) : 0, 11070441
gantt
title petclinic - break down per module: candidate=1.54.0-SNAPSHOT~63e5d5a068, baseline=1.55.0-SNAPSHOT~37454135e4
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.478 ms) : 0, 1478
crashtracking [candidate] (1.472 ms) : 0, 1472
BytebuddyAgent [baseline] (698.958 ms) : 0, 698958
BytebuddyAgent [candidate] (689.276 ms) : 0, 689276
GlobalTracer [baseline] (242.831 ms) : 0, 242831
GlobalTracer [candidate] (248.69 ms) : 0, 248690
AppSec [baseline] (32.907 ms) : 0, 32907
AppSec [candidate] (30.996 ms) : 0, 30996
Debugger [baseline] (6.393 ms) : 0, 6393
Debugger [candidate] (6.392 ms) : 0, 6392
Remote Config [baseline] (690.676 µs) : 0, 691
Remote Config [candidate] (676.701 µs) : 0, 677
Telemetry [baseline] (9.24 ms) : 0, 9240
Telemetry [candidate] (8.975 ms) : 0, 8975
Flare Poller [baseline] (10.813 ms) : 0, 10813
section appsec
crashtracking [baseline] (1.464 ms) : 0, 1464
crashtracking [candidate] (1.462 ms) : 0, 1462
BytebuddyAgent [baseline] (717.482 ms) : 0, 717482
BytebuddyAgent [candidate] (712.043 ms) : 0, 712043
GlobalTracer [baseline] (234.167 ms) : 0, 234167
GlobalTracer [candidate] (239.893 ms) : 0, 239893
AppSec [baseline] (175.502 ms) : 0, 175502
AppSec [candidate] (172.428 ms) : 0, 172428
Debugger [baseline] (6.072 ms) : 0, 6072
Debugger [candidate] (5.949 ms) : 0, 5949
Remote Config [baseline] (630.129 µs) : 0, 630
Remote Config [candidate] (650.341 µs) : 0, 650
Telemetry [baseline] (8.392 ms) : 0, 8392
Telemetry [candidate] (8.451 ms) : 0, 8451
Flare Poller [baseline] (3.907 ms) : 0, 3907
IAST [baseline] (24.742 ms) : 0, 24742
IAST [candidate] (24.591 ms) : 0, 24591
section iast
crashtracking [baseline] (1.456 ms) : 0, 1456
crashtracking [candidate] (1.457 ms) : 0, 1457
BytebuddyAgent [baseline] (817.421 ms) : 0, 817421
BytebuddyAgent [candidate] (810.933 ms) : 0, 810933
GlobalTracer [baseline] (232.479 ms) : 0, 232479
GlobalTracer [candidate] (237.684 ms) : 0, 237684
AppSec [baseline] (35.472 ms) : 0, 35472
AppSec [candidate] (32.94 ms) : 0, 32940
Debugger [baseline] (6.079 ms) : 0, 6079
Debugger [candidate] (6.11 ms) : 0, 6110
Remote Config [baseline] (610.47 µs) : 0, 610
Remote Config [candidate] (592.156 µs) : 0, 592
Telemetry [baseline] (8.597 ms) : 0, 8597
Telemetry [candidate] (8.308 ms) : 0, 8308
Flare Poller [baseline] (4.162 ms) : 0, 4162
IAST [baseline] (26.443 ms) : 0, 26443
IAST [candidate] (26.666 ms) : 0, 26666
section profiling
ProfilingAgent [baseline] (108.175 ms) : 0, 108175
ProfilingAgent [candidate] (101.328 ms) : 0, 101328
crashtracking [baseline] (1.425 ms) : 0, 1425
crashtracking [candidate] (1.452 ms) : 0, 1452
BytebuddyAgent [baseline] (719.366 ms) : 0, 719366
BytebuddyAgent [candidate] (719.468 ms) : 0, 719468
GlobalTracer [baseline] (216.666 ms) : 0, 216666
GlobalTracer [candidate] (224.794 ms) : 0, 224794
AppSec [baseline] (33.017 ms) : 0, 33017
AppSec [candidate] (31.359 ms) : 0, 31359
Debugger [baseline] (7.337 ms) : 0, 7337
Debugger [candidate] (7.321 ms) : 0, 7321
Remote Config [baseline] (692.24 µs) : 0, 692
Remote Config [candidate] (702.413 µs) : 0, 702
Telemetry [baseline] (15.822 ms) : 0, 15822
Telemetry [candidate] (15.547 ms) : 0, 15547
Profiling [baseline] (109.453 ms) : 0, 109453
Profiling [candidate] (101.944 ms) : 0, 101944
Flare Poller [baseline] (4.216 ms) : 0, 4216
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.54.0-SNAPSHOT~63e5d5a068, baseline=1.55.0-SNAPSHOT~37454135e4
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.02 s) : 0, 1020499
Total [baseline] (8.675 s) : 0, 8674934
Agent [candidate] (1.013 s) : 0, 1012637
Total [candidate] (8.664 s) : 0, 8663759
section iast
Agent [baseline] (1.151 s) : 0, 1150895
Total [baseline] (9.242 s) : 0, 9241797
Agent [candidate] (1.147 s) : 0, 1147128
Total [candidate] (9.27 s) : 0, 9269787
gantt
title insecure-bank - break down per module: candidate=1.54.0-SNAPSHOT~63e5d5a068, baseline=1.55.0-SNAPSHOT~37454135e4
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.483 ms) : 0, 1483
crashtracking [candidate] (1.485 ms) : 0, 1485
BytebuddyAgent [baseline] (695.869 ms) : 0, 695869
BytebuddyAgent [candidate] (693.451 ms) : 0, 693451
GlobalTracer [baseline] (242.296 ms) : 0, 242296
GlobalTracer [candidate] (249.237 ms) : 0, 249237
AppSec [baseline] (32.997 ms) : 0, 32997
AppSec [candidate] (31.167 ms) : 0, 31167
Debugger [baseline] (6.453 ms) : 0, 6453
Debugger [candidate] (6.415 ms) : 0, 6415
Remote Config [baseline] (700.9 µs) : 0, 701
Remote Config [candidate] (686.522 µs) : 0, 687
Telemetry [baseline] (9.268 ms) : 0, 9268
Telemetry [candidate] (9.001 ms) : 0, 9001
Flare Poller [baseline] (10.289 ms) : 0, 10289
section iast
crashtracking [baseline] (1.465 ms) : 0, 1465
crashtracking [candidate] (1.466 ms) : 0, 1466
BytebuddyAgent [baseline] (814.459 ms) : 0, 814459
BytebuddyAgent [candidate] (811.744 ms) : 0, 811744
GlobalTracer [baseline] (231.832 ms) : 0, 231832
GlobalTracer [candidate] (237.179 ms) : 0, 237179
IAST [baseline] (26.788 ms) : 0, 26788
IAST [candidate] (26.111 ms) : 0, 26111
AppSec [baseline] (35.556 ms) : 0, 35556
AppSec [candidate] (34.304 ms) : 0, 34304
Debugger [baseline] (6.123 ms) : 0, 6123
Debugger [candidate] (6.105 ms) : 0, 6105
Remote Config [baseline] (616.769 µs) : 0, 617
Remote Config [candidate] (592.387 µs) : 0, 592
Telemetry [baseline] (8.689 ms) : 0, 8689
Telemetry [candidate] (8.414 ms) : 0, 8414
Flare Poller [baseline] (4.161 ms) : 0, 4161
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 petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~63e5d5a068, baseline=1.55.0-SNAPSHOT~37454135e4
dateFormat X
axisFormat %s
section baseline
no_agent (36.409 ms) : 36115, 36702
. : milestone, 36409,
appsec (49.206 ms) : 48768, 49644
. : milestone, 49206,
code_origins (43.904 ms) : 43524, 44284
. : milestone, 43904,
iast (44.895 ms) : 44516, 45274
. : milestone, 44895,
profiling (47.951 ms) : 47451, 48451
. : milestone, 47951,
tracing (44.145 ms) : 43772, 44517
. : milestone, 44145,
section candidate
no_agent (36.541 ms) : 36244, 36839
. : milestone, 36541,
appsec (47.795 ms) : 47372, 48218
. : milestone, 47795,
code_origins (42.959 ms) : 42584, 43333
. : milestone, 42959,
iast (45.972 ms) : 45567, 46376
. : milestone, 45972,
profiling (50.552 ms) : 50071, 51033
. : milestone, 50552,
tracing (45.001 ms) : 44612, 45390
. : milestone, 45001,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~63e5d5a068, baseline=1.55.0-SNAPSHOT~37454135e4
dateFormat X
axisFormat %s
section baseline
no_agent (4.195 ms) : 4148, 4242
. : milestone, 4195,
iast (10.005 ms) : 9836, 10173
. : milestone, 10005,
iast_FULL (15.074 ms) : 14774, 15374
. : milestone, 15074,
iast_GLOBAL (10.68 ms) : 10492, 10869
. : milestone, 10680,
profiling (8.815 ms) : 8680, 8951
. : milestone, 8815,
tracing (7.537 ms) : 7431, 7643
. : milestone, 7537,
section candidate
no_agent (4.317 ms) : 4259, 4375
. : milestone, 4317,
iast (9.838 ms) : 9674, 10003
. : milestone, 9838,
iast_FULL (13.901 ms) : 13623, 14180
. : milestone, 13901,
iast_GLOBAL (10.697 ms) : 10510, 10885
. : milestone, 10697,
profiling (9.287 ms) : 9120, 9455
. : milestone, 9287,
tracing (7.556 ms) : 7440, 7672
. : milestone, 7556,
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 biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.54.0-SNAPSHOT~63e5d5a068, baseline=1.55.0-SNAPSHOT~37454135e4
dateFormat X
axisFormat %s
section baseline
no_agent (14.98 s) : 14980000, 14980000
. : milestone, 14980000,
appsec (15.035 s) : 15035000, 15035000
. : milestone, 15035000,
iast (18.248 s) : 18248000, 18248000
. : milestone, 18248000,
iast_GLOBAL (18.085 s) : 18085000, 18085000
. : milestone, 18085000,
profiling (15.363 s) : 15363000, 15363000
. : milestone, 15363000,
tracing (15.092 s) : 15092000, 15092000
. : milestone, 15092000,
section candidate
no_agent (15.487 s) : 15487000, 15487000
. : milestone, 15487000,
appsec (15.326 s) : 15326000, 15326000
. : milestone, 15326000,
iast (18.479 s) : 18479000, 18479000
. : milestone, 18479000,
iast_GLOBAL (18.257 s) : 18257000, 18257000
. : milestone, 18257000,
profiling (15.433 s) : 15433000, 15433000
. : milestone, 15433000,
tracing (15.4 s) : 15400000, 15400000
. : milestone, 15400000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.54.0-SNAPSHOT~63e5d5a068, baseline=1.55.0-SNAPSHOT~37454135e4
dateFormat X
axisFormat %s
section baseline
no_agent (1.469 ms) : 1458, 1481
. : milestone, 1469,
appsec (3.671 ms) : 3457, 3884
. : milestone, 3671,
iast (2.214 ms) : 2150, 2278
. : milestone, 2214,
iast_GLOBAL (2.246 ms) : 2182, 2310
. : milestone, 2246,
profiling (2.069 ms) : 2017, 2122
. : milestone, 2069,
tracing (2.026 ms) : 1976, 2076
. : milestone, 2026,
section candidate
no_agent (1.478 ms) : 1467, 1490
. : milestone, 1478,
appsec (3.704 ms) : 3485, 3922
. : milestone, 3704,
iast (2.202 ms) : 2139, 2265
. : milestone, 2202,
iast_GLOBAL (2.251 ms) : 2187, 2314
. : milestone, 2251,
profiling (2.048 ms) : 1996, 2099
. : milestone, 2048,
tracing (2.022 ms) : 1973, 2071
. : milestone, 2022,
|
🎯 Code Coverage 🔗 Commit SHA: 63e5d5a | 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
…adability and hide supported-configuration details
12e5514
to
5fe0a88
Compare
… ControllableEnvironmentVariables
Debugger benchmarksParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 9 metrics, 6 unstable metrics. See unchanged results
Request duration reports for reportsgantt
title reports - request duration [CI 0.99] : candidate=None, baseline=None
dateFormat X
axisFormat %s
section baseline
noprobe (316.631 µs) : 286, 347
. : milestone, 317,
basic (281.639 µs) : 275, 288
. : milestone, 282,
loop (8.961 ms) : 8958, 8965
. : milestone, 8961,
section candidate
noprobe (317.685 µs) : 281, 354
. : milestone, 318,
basic (277.696 µs) : 271, 284
. : milestone, 278,
loop (8.959 ms) : 8954, 8963
. : milestone, 8959,
|
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.
Looking good.
Left a comment about unnecessary allocation.
...fig-utils/src/test/java/datadog/trace/config/inversion/TestSupportedConfigurationSource.java
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.
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 :)
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.json
file.Components:
ConfigInversionStrictStyle.java
Strict
which does not allow any usage of an unknown DD/OTEL environment variable,Warning
which allows the usage but sends telemetry about unknown environment variables, andTest
which allows the usage of unknown environment variables without sending telemetry.Warning
ConfigHelper.java
supported-configurations.json
to ensure the environment variable queried for is "known"ConfigInversionStrictStyle
that 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
ConfigInversionMetricCollector
toconfig-utils
module #9566Contributor 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]