-
Notifications
You must be signed in to change notification settings - Fork 312
Migrate Config system to environment component #9191
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
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 insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.52.0-SNAPSHOT~68fc6caee7, baseline=1.52.0-SNAPSHOT~887ea397cc
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.043 s) : 0, 1043185
Total [baseline] (8.629 s) : 0, 8628841
Agent [candidate] (1.038 s) : 0, 1037632
Total [candidate] (8.591 s) : 0, 8591453
section iast
Agent [baseline] (1.18 s) : 0, 1179721
Total [baseline] (9.276 s) : 0, 9276243
Agent [candidate] (1.171 s) : 0, 1170925
Total [candidate] (9.301 s) : 0, 9301212
gantt
title insecure-bank - break down per module: candidate=1.52.0-SNAPSHOT~68fc6caee7, baseline=1.52.0-SNAPSHOT~887ea397cc
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.432 ms) : 0, 1432
crashtracking [candidate] (1.431 ms) : 0, 1431
BytebuddyAgent [baseline] (730.805 ms) : 0, 730805
BytebuddyAgent [candidate] (729.124 ms) : 0, 729124
GlobalTracer [baseline] (243.943 ms) : 0, 243943
GlobalTracer [candidate] (240.962 ms) : 0, 240962
AppSec [baseline] (30.874 ms) : 0, 30874
AppSec [candidate] (30.363 ms) : 0, 30363
Debugger [baseline] (6.119 ms) : 0, 6119
Debugger [candidate] (6.017 ms) : 0, 6017
Remote Config [baseline] (665.601 µs) : 0, 666
Remote Config [candidate] (657.239 µs) : 0, 657
Telemetry [baseline] (8.377 ms) : 0, 8377
Telemetry [candidate] (8.178 ms) : 0, 8178
section iast
crashtracking [baseline] (1.439 ms) : 0, 1439
crashtracking [candidate] (1.422 ms) : 0, 1422
BytebuddyAgent [baseline] (851.889 ms) : 0, 851889
BytebuddyAgent [candidate] (845.684 ms) : 0, 845684
GlobalTracer [baseline] (232.363 ms) : 0, 232363
GlobalTracer [candidate] (230.87 ms) : 0, 230870
IAST [baseline] (29.232 ms) : 0, 29232
IAST [candidate] (30.559 ms) : 0, 30559
AppSec [baseline] (27.478 ms) : 0, 27478
AppSec [candidate] (26.424 ms) : 0, 26424
Debugger [baseline] (7.699 ms) : 0, 7699
Debugger [candidate] (6.702 ms) : 0, 6702
Remote Config [baseline] (589.34 µs) : 0, 589
Remote Config [candidate] (584.045 µs) : 0, 584
Telemetry [baseline] (8.001 ms) : 0, 8001
Telemetry [candidate] (7.852 ms) : 0, 7852
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.52.0-SNAPSHOT~68fc6caee7, baseline=1.52.0-SNAPSHOT~887ea397cc
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.046 s) : 0, 1045739
Total [baseline] (10.623 s) : 0, 10623202
Agent [candidate] (1.04 s) : 0, 1040318
Total [candidate] (10.691 s) : 0, 10690807
section appsec
Agent [baseline] (1.218 s) : 0, 1218487
Total [baseline] (10.762 s) : 0, 10762249
Agent [candidate] (1.216 s) : 0, 1215991
Total [candidate] (10.755 s) : 0, 10755221
section iast
Agent [baseline] (1.175 s) : 0, 1174660
Total [baseline] (10.911 s) : 0, 10911384
Agent [candidate] (1.173 s) : 0, 1172982
Total [candidate] (10.937 s) : 0, 10936965
section profiling
Agent [baseline] (1.183 s) : 0, 1182999
Total [baseline] (10.825 s) : 0, 10824705
Agent [candidate] (1.182 s) : 0, 1182176
Total [candidate] (10.816 s) : 0, 10816182
gantt
title petclinic - break down per module: candidate=1.52.0-SNAPSHOT~68fc6caee7, baseline=1.52.0-SNAPSHOT~887ea397cc
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.436 ms) : 0, 1436
crashtracking [candidate] (1.442 ms) : 0, 1442
BytebuddyAgent [baseline] (734.51 ms) : 0, 734510
BytebuddyAgent [candidate] (731.427 ms) : 0, 731427
GlobalTracer [baseline] (242.513 ms) : 0, 242513
GlobalTracer [candidate] (241.146 ms) : 0, 241146
AppSec [baseline] (30.56 ms) : 0, 30560
AppSec [candidate] (30.464 ms) : 0, 30464
Debugger [baseline] (6.046 ms) : 0, 6046
Debugger [candidate] (5.999 ms) : 0, 5999
Remote Config [baseline] (649.402 µs) : 0, 649
Remote Config [candidate] (641.034 µs) : 0, 641
Telemetry [baseline] (9.017 ms) : 0, 9017
Telemetry [candidate] (8.179 ms) : 0, 8179
section appsec
crashtracking [baseline] (1.433 ms) : 0, 1433
crashtracking [candidate] (1.42 ms) : 0, 1420
BytebuddyAgent [baseline] (753.466 ms) : 0, 753466
BytebuddyAgent [candidate] (751.025 ms) : 0, 751025
GlobalTracer [baseline] (233.975 ms) : 0, 233975
GlobalTracer [candidate] (233.984 ms) : 0, 233984
IAST [baseline] (23.493 ms) : 0, 23493
IAST [candidate] (23.47 ms) : 0, 23470
AppSec [baseline] (168.261 ms) : 0, 168261
AppSec [candidate] (168.314 ms) : 0, 168314
Debugger [baseline] (7.844 ms) : 0, 7844
Debugger [candidate] (7.866 ms) : 0, 7866
Remote Config [baseline] (621.873 µs) : 0, 622
Remote Config [candidate] (611.141 µs) : 0, 611
Telemetry [baseline] (8.127 ms) : 0, 8127
Telemetry [candidate] (8.054 ms) : 0, 8054
section iast
crashtracking [baseline] (1.426 ms) : 0, 1426
crashtracking [candidate] (1.438 ms) : 0, 1438
BytebuddyAgent [baseline] (848.073 ms) : 0, 848073
BytebuddyAgent [candidate] (846.951 ms) : 0, 846951
GlobalTracer [baseline] (231.852 ms) : 0, 231852
GlobalTracer [candidate] (231.348 ms) : 0, 231348
IAST [baseline] (27.443 ms) : 0, 27443
IAST [candidate] (29.796 ms) : 0, 29796
AppSec [baseline] (29.686 ms) : 0, 29686
AppSec [candidate] (25.772 ms) : 0, 25772
Debugger [baseline] (6.637 ms) : 0, 6637
Debugger [candidate] (8.249 ms) : 0, 8249
Remote Config [baseline] (581.809 µs) : 0, 582
Remote Config [candidate] (583.542 µs) : 0, 584
Telemetry [baseline] (7.979 ms) : 0, 7979
Telemetry [candidate] (7.865 ms) : 0, 7865
section profiling
crashtracking [baseline] (1.391 ms) : 0, 1391
crashtracking [candidate] (1.394 ms) : 0, 1394
BytebuddyAgent [baseline] (759.082 ms) : 0, 759082
BytebuddyAgent [candidate] (757.817 ms) : 0, 757817
GlobalTracer [baseline] (220.171 ms) : 0, 220171
GlobalTracer [candidate] (219.617 ms) : 0, 219617
AppSec [baseline] (30.287 ms) : 0, 30287
AppSec [candidate] (30.162 ms) : 0, 30162
Debugger [baseline] (6.252 ms) : 0, 6252
Debugger [candidate] (6.28 ms) : 0, 6280
Remote Config [baseline] (662.873 µs) : 0, 663
Remote Config [candidate] (673.12 µs) : 0, 673
Telemetry [baseline] (12.628 ms) : 0, 12628
Telemetry [candidate] (11.78 ms) : 0, 11780
ProfilingAgent [baseline] (104.065 ms) : 0, 104065
ProfilingAgent [candidate] (106.041 ms) : 0, 106041
Profiling [baseline] (104.088 ms) : 0, 104088
Profiling [candidate] (106.064 ms) : 0, 106064
LoadParameters
See matching parameters
SummaryFound 2 performance improvements and 2 performance regressions! Performance is the same for 8 metrics, 12 unstable metrics.
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.52.0-SNAPSHOT~68fc6caee7, baseline=1.52.0-SNAPSHOT~887ea397cc
dateFormat X
axisFormat %s
section baseline
no_agent (4.436 ms) : 4386, 4485
. : milestone, 4436,
iast (9.27 ms) : 9113, 9427
. : milestone, 9270,
iast_FULL (13.523 ms) : 13257, 13790
. : milestone, 13523,
iast_GLOBAL (10.144 ms) : 9966, 10323
. : milestone, 10144,
profiling (8.404 ms) : 8276, 8533
. : milestone, 8404,
tracing (7.518 ms) : 7407, 7630
. : milestone, 7518,
section candidate
no_agent (4.59 ms) : 4538, 4642
. : milestone, 4590,
iast (9.402 ms) : 9248, 9557
. : milestone, 9402,
iast_FULL (13.91 ms) : 13635, 14186
. : milestone, 13910,
iast_GLOBAL (10.706 ms) : 10518, 10894
. : milestone, 10706,
profiling (8.597 ms) : 8466, 8729
. : milestone, 8597,
tracing (7.634 ms) : 7524, 7744
. : milestone, 7634,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.52.0-SNAPSHOT~68fc6caee7, baseline=1.52.0-SNAPSHOT~887ea397cc
dateFormat X
axisFormat %s
section baseline
no_agent (37.778 ms) : 37463, 38094
. : milestone, 37778,
appsec (48.757 ms) : 48304, 49210
. : milestone, 48757,
code_origins (44.694 ms) : 44309, 45079
. : milestone, 44694,
iast (44.841 ms) : 44451, 45231
. : milestone, 44841,
profiling (47.623 ms) : 47191, 48055
. : milestone, 47623,
tracing (43.412 ms) : 43043, 43781
. : milestone, 43412,
section candidate
no_agent (36.557 ms) : 36261, 36852
. : milestone, 36557,
appsec (47.674 ms) : 47225, 48122
. : milestone, 47674,
code_origins (42.924 ms) : 42572, 43276
. : milestone, 42924,
iast (44.892 ms) : 44486, 45297
. : milestone, 44892,
profiling (48.774 ms) : 48304, 49245
. : milestone, 48774,
tracing (43.89 ms) : 43520, 44259
. : milestone, 43890,
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.52.0-SNAPSHOT~68fc6caee7, baseline=1.52.0-SNAPSHOT~887ea397cc
dateFormat X
axisFormat %s
section baseline
no_agent (1.473 ms) : 1461, 1484
. : milestone, 1473,
appsec (3.691 ms) : 3472, 3910
. : milestone, 3691,
iast (2.226 ms) : 2161, 2291
. : milestone, 2226,
iast_GLOBAL (2.278 ms) : 2212, 2344
. : milestone, 2278,
profiling (2.08 ms) : 2026, 2134
. : milestone, 2080,
tracing (2.032 ms) : 1981, 2083
. : milestone, 2032,
section candidate
no_agent (1.476 ms) : 1465, 1488
. : milestone, 1476,
appsec (3.674 ms) : 3457, 3892
. : milestone, 3674,
iast (2.223 ms) : 2157, 2288
. : milestone, 2223,
iast_GLOBAL (2.256 ms) : 2191, 2322
. : milestone, 2256,
profiling (2.063 ms) : 2011, 2116
. : milestone, 2063,
tracing (2.038 ms) : 1987, 2089
. : milestone, 2038,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.52.0-SNAPSHOT~68fc6caee7, baseline=1.52.0-SNAPSHOT~887ea397cc
dateFormat X
axisFormat %s
section baseline
no_agent (15.455 s) : 15455000, 15455000
. : milestone, 15455000,
appsec (14.749 s) : 14749000, 14749000
. : milestone, 14749000,
iast (18.039 s) : 18039000, 18039000
. : milestone, 18039000,
iast_GLOBAL (17.604 s) : 17604000, 17604000
. : milestone, 17604000,
profiling (15.221 s) : 15221000, 15221000
. : milestone, 15221000,
tracing (14.912 s) : 14912000, 14912000
. : milestone, 14912000,
section candidate
no_agent (15.65 s) : 15650000, 15650000
. : milestone, 15650000,
appsec (14.837 s) : 14837000, 14837000
. : milestone, 14837000,
iast (18.393 s) : 18393000, 18393000
. : milestone, 18393000,
iast_GLOBAL (17.899 s) : 17899000, 17899000
. : milestone, 17899000,
profiling (15.425 s) : 15425000, 15425000
. : milestone, 15425000,
tracing (14.807 s) : 14807000, 14807000
. : milestone, 14807000,
|
78ad76f
to
9d287cb
Compare
b6c331b
to
2512a49
Compare
9d287cb
to
d374062
Compare
2512a49
to
fe762c4
Compare
3cca925
to
8647cfd
Compare
fe762c4
to
41de4a2
Compare
8647cfd
to
e085472
Compare
41de4a2
to
42d109e
Compare
dd-java-agent/src/test/groovy/datadog/trace/agent/InitializationTelemetryTest.groovy
Show resolved
Hide resolved
@@ -205,7 +204,7 @@ private static Properties loadOtelConfigFile() { | |||
String path = getProperty("otel.javaagent.configuration-file"); | |||
if (null != path && !path.isEmpty()) { | |||
if (path.charAt(0) == '~') { | |||
path = System.getProperty("user.home") + path.substring(1); | |||
path = SystemProperties.getOrDefault("user.home", "") + path.substring(1); |
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 a minor question: why getOrDefault
? is it possible not to have user.home
?
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.
If the security manager prevents access to this property, SystemProperties.get()
will return null
.
So using getOrDefault(key, '')
should avoid NPE or "null" in path.
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.
Got it. But just curious, how previous code worked?
And would it make sense to build a path that will be not correct?
I have a feeling that we need method in SystemProperties
class that will throw IllegalStateException
in case when we must have a value.
Here instead of NPE we will introduce logic error.
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.
Got it. But just curious, how previous code worked?
I think the whole OTel config source init fails, then config init fails.
And would it make sense to build a path that will be not correct?
That would be a question for @mcculls 😉
I have a feeling that we need method in SystemProperties class that will throw IllegalStateException in case when we must have a value.
We can still check if a value is missing using null check and no default value. The question stays: how should we deal with this case then if we don't want to have a logic error?
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 finally went with a safer approach: only do the ~
substitution if env.home
property is set and retrieved.
I applied the same logic to the ConfigProvider
(around line 475)
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.
The OTel code doesn't handle this condition: https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/config/ConfigurationFile.java#L57 - so we can choose.
TBH I doubt that anyone except maybe developers uses the ~
prefix for OTel configuration files, instead preferring the more stable absolute path. This scenario is specific to someone who wants to use an external config file, declares the path to that file using ~
, and has a security manager installed that disallows system property access.
This is so unlikely I think using ""
is ok as a fallback - but TBH I would also be fine with letting it throw an exception, because this falls into the category of an exceptional situation where it might be safer to not try to second guess...
@@ -205,7 +204,7 @@ private static Properties loadOtelConfigFile() { | |||
String path = getProperty("otel.javaagent.configuration-file"); | |||
if (null != path && !path.isEmpty()) { | |||
if (path.charAt(0) == '~') { | |||
path = System.getProperty("user.home") + path.substring(1); | |||
path = SystemProperties.getOrDefault("user.home", "") + path.substring(1); |
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.
Got it. But just curious, how previous code worked?
And would it make sense to build a path that will be not correct?
I have a feeling that we need method in SystemProperties
class that will throw IllegalStateException
in case when we must have a value.
Here instead of NPE we will introduce logic error.
42d109e
to
68fc6ca
Compare
68fc6ca
to
e7cb973
Compare
e7cb973
to
a3d54e9
Compare
What Does This Do
This PR migrates the config system to the environment component.
It additionally improves the environment component with:
SystemProperties.clear()
null
handling onSystemProperties
for theset
andclear
methods.Motivation
Safely interact with the env var and system properties by handling security manager exception and possible NPE.
Additional Notes
Environment component related stacked PRs:
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: LANGPLAT-458