-
Notifications
You must be signed in to change notification settings - Fork 279
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
Try to locate tracer JAR using class loader resource lookup when bootstrapping the agent #6126
Try to locate tracer JAR using class loader resource lookup when bootstrapping the agent #6126
Conversation
…strapping the agent
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 7 performance regressions! Performance is the same for 47 cases.
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.23.0-SNAPSHOT~70d9234851, baseline=1.24.0-SNAPSHOT~3c1890cf33
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.033 s) : 0, 1032690
Total [baseline] (9.348 s) : 0, 9347854
Agent [candidate] (1.046 s) : 0, 1046431
Total [candidate] (9.338 s) : 0, 9337735
section appsec
Agent [baseline] (1.129 s) : 0, 1128761
Total [baseline] (9.384 s) : 0, 9383707
Agent [candidate] (1.119 s) : 0, 1119486
Total [candidate] (9.43 s) : 0, 9429543
section iast
Agent [baseline] (1.148 s) : 0, 1147917
Total [baseline] (9.55 s) : 0, 9550137
Agent [candidate] (1.154 s) : 0, 1153916
Total [candidate] (9.573 s) : 0, 9573027
section profiling
Agent [baseline] (1.218 s) : 0, 1217737
Total [baseline] (9.505 s) : 0, 9504862
Agent [candidate] (1.229 s) : 0, 1229214
Total [candidate] (9.604 s) : 0, 9603708
gantt
title petclinic - break down per module: candidate=1.23.0-SNAPSHOT~70d9234851, baseline=1.24.0-SNAPSHOT~3c1890cf33
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (646.961 ms) : 0, 646961
BytebuddyAgent [candidate] (652.411 ms) : 0, 652411
GlobalTracer [baseline] (294.533 ms) : 0, 294533
GlobalTracer [candidate] (297.704 ms) : 0, 297704
AppSec [baseline] (48.863 ms) : 0, 48863
AppSec [candidate] (49.383 ms) : 0, 49383
Remote Config [baseline] (663.627 µs) : 0, 664
Remote Config [candidate] (710.142 µs) : 0, 710
Telemetry [baseline] (7.159 ms) : 0, 7159
Telemetry [candidate] (11.47 ms) : 0, 11470
section appsec
BytebuddyAgent [baseline] (651.335 ms) : 0, 651335
BytebuddyAgent [candidate] (645.653 ms) : 0, 645653
GlobalTracer [baseline] (296.61 ms) : 0, 296610
GlobalTracer [candidate] (294.042 ms) : 0, 294042
AppSec [baseline] (138.787 ms) : 0, 138787
AppSec [candidate] (137.932 ms) : 0, 137932
Remote Config [baseline] (653.382 µs) : 0, 653
Remote Config [candidate] (644.057 µs) : 0, 644
Telemetry [baseline] (6.789 ms) : 0, 6789
Telemetry [candidate] (6.872 ms) : 0, 6872
section iast
BytebuddyAgent [baseline] (767.862 ms) : 0, 767862
BytebuddyAgent [candidate] (766.764 ms) : 0, 766764
GlobalTracer [baseline] (275.022 ms) : 0, 275022
GlobalTracer [candidate] (274.951 ms) : 0, 274951
AppSec [baseline] (46.17 ms) : 0, 46170
AppSec [candidate] (46.993 ms) : 0, 46993
Remote Config [baseline] (558.69 µs) : 0, 559
Remote Config [candidate] (577.958 µs) : 0, 578
Telemetry [baseline] (7.13 ms) : 0, 7130
Telemetry [candidate] (12.568 ms) : 0, 12568
IAST [baseline] (16.673 ms) : 0, 16673
IAST [candidate] (17.604 ms) : 0, 17604
section profiling
ProfilingAgent [baseline] (87.996 ms) : 0, 87996
ProfilingAgent [candidate] (88.65 ms) : 0, 88650
BytebuddyAgent [baseline] (658.414 ms) : 0, 658414
BytebuddyAgent [candidate] (663.498 ms) : 0, 663498
GlobalTracer [baseline] (359.931 ms) : 0, 359931
GlobalTracer [candidate] (360.87 ms) : 0, 360870
AppSec [baseline] (49.009 ms) : 0, 49009
AppSec [candidate] (49.415 ms) : 0, 49415
Remote Config [baseline] (641.618 µs) : 0, 642
Remote Config [candidate] (653.776 µs) : 0, 654
Telemetry [baseline] (7.421 ms) : 0, 7421
Telemetry [candidate] (11.432 ms) : 0, 11432
Profiling [baseline] (88.019 ms) : 0, 88019
Profiling [candidate] (88.675 ms) : 0, 88675
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.23.0-SNAPSHOT~70d9234851, baseline=1.24.0-SNAPSHOT~3c1890cf33
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.034 s) : 0, 1033533
Total [baseline] (8.786 s) : 0, 8785781
Agent [candidate] (1.045 s) : 0, 1044674
Total [candidate] (8.832 s) : 0, 8832290
section iast
Agent [baseline] (1.157 s) : 0, 1157000
Total [baseline] (9.321 s) : 0, 9321064
Agent [candidate] (1.154 s) : 0, 1153909
Total [candidate] (9.343 s) : 0, 9342696
section iast_TELEMETRY_OFF
Agent [baseline] (1.142 s) : 0, 1141704
Total [baseline] (9.289 s) : 0, 9289239
Agent [candidate] (1.144 s) : 0, 1143781
Total [candidate] (9.313 s) : 0, 9312801
gantt
title insecure-bank - break down per module: candidate=1.23.0-SNAPSHOT~70d9234851, baseline=1.24.0-SNAPSHOT~3c1890cf33
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (646.922 ms) : 0, 646922
BytebuddyAgent [candidate] (651.483 ms) : 0, 651483
GlobalTracer [baseline] (295.145 ms) : 0, 295145
GlobalTracer [candidate] (297.138 ms) : 0, 297138
AppSec [baseline] (49.181 ms) : 0, 49181
AppSec [candidate] (49.194 ms) : 0, 49194
Remote Config [baseline] (669.145 µs) : 0, 669
Remote Config [candidate] (707.445 µs) : 0, 707
Telemetry [baseline] (7.248 ms) : 0, 7248
Telemetry [candidate] (11.374 ms) : 0, 11374
section iast
BytebuddyAgent [baseline] (773.312 ms) : 0, 773312
BytebuddyAgent [candidate] (766.706 ms) : 0, 766706
GlobalTracer [baseline] (276.987 ms) : 0, 276987
GlobalTracer [candidate] (274.347 ms) : 0, 274347
AppSec [baseline] (47.033 ms) : 0, 47033
AppSec [candidate] (46.988 ms) : 0, 46988
IAST [baseline] (15.753 ms) : 0, 15753
IAST [candidate] (16.113 ms) : 0, 16113
Remote Config [baseline] (575.947 µs) : 0, 576
Remote Config [candidate] (564.659 µs) : 0, 565
Telemetry [baseline] (8.613 ms) : 0, 8613
Telemetry [candidate] (14.701 ms) : 0, 14701
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (760.148 ms) : 0, 760148
BytebuddyAgent [candidate] (758.274 ms) : 0, 758274
GlobalTracer [baseline] (274.919 ms) : 0, 274919
GlobalTracer [candidate] (274.296 ms) : 0, 274296
AppSec [baseline] (46.372 ms) : 0, 46372
AppSec [candidate] (46.391 ms) : 0, 46391
IAST [baseline] (16.744 ms) : 0, 16744
IAST [candidate] (19.528 ms) : 0, 19528
Remote Config [baseline] (582.563 µs) : 0, 583
Remote Config [candidate] (566.155 µs) : 0, 566
Telemetry [baseline] (8.46 ms) : 0, 8460
Telemetry [candidate] (10.364 ms) : 0, 10364
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 22 cases. Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.23.0-SNAPSHOT~70d9234851, baseline=1.24.0-SNAPSHOT~3c1890cf33
dateFormat X
axisFormat %s
section baseline
no_agent (1.341 ms) : 1321, 1360
. : milestone, 1341,
appsec (1.736 ms) : 1711, 1760
. : milestone, 1736,
iast (1.506 ms) : 1482, 1531
. : milestone, 1506,
profiling (1.496 ms) : 1471, 1522
. : milestone, 1496,
tracing (1.459 ms) : 1434, 1484
. : milestone, 1459,
section candidate
no_agent (1.338 ms) : 1319, 1357
. : milestone, 1338,
appsec (1.728 ms) : 1704, 1753
. : milestone, 1728,
iast (1.501 ms) : 1477, 1525
. : milestone, 1501,
profiling (1.469 ms) : 1444, 1494
. : milestone, 1469,
tracing (1.491 ms) : 1467, 1515
. : milestone, 1491,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.23.0-SNAPSHOT~70d9234851, baseline=1.24.0-SNAPSHOT~3c1890cf33
dateFormat X
axisFormat %s
section baseline
no_agent (360.977 µs) : 341, 381
. : milestone, 361,
iast (470.374 µs) : 449, 491
. : milestone, 470,
iast_FULL (537.021 µs) : 516, 558
. : milestone, 537,
iast_INACTIVE (445.75 µs) : 425, 466
. : milestone, 446,
iast_TELEMETRY_OFF (470.533 µs) : 449, 492
. : milestone, 471,
tracing (441.75 µs) : 421, 463
. : milestone, 442,
section candidate
no_agent (363.396 µs) : 344, 383
. : milestone, 363,
iast (468.831 µs) : 448, 490
. : milestone, 469,
iast_FULL (524.532 µs) : 504, 545
. : milestone, 525,
iast_INACTIVE (444.984 µs) : 423, 467
. : milestone, 445,
iast_TELEMETRY_OFF (459.707 µs) : 439, 480
. : milestone, 460,
tracing (439.396 µs) : 418, 460
. : milestone, 439,
|
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 have the same issue with IntelliJ classloader, which strips the protection domain. So when two agents are loaded at the same time (e.g the Kotlin Coroutine debugger agent) dd-trace-java bails out.
Coincidentally I was trying to fix AgentBootstrap
for that reason, using a property as a fall back instead of short circuiting when there are multiple agents. However the proposed approach seems to work better without "user" intervention.
For reference I have reproduced the failure with IJ there bric3/dd-trace-java-with-ij-classloading-and-another-agent, and trying your change avoid the issue.
I believe the feature is looking good, but I only comment as I'm not a member of this project.
dd-java-agent/src/main/java/datadog/trace/bootstrap/AgentBootstrap.java
Outdated
Show resolved
Hide resolved
dd-java-agent/src/main/java/datadog/trace/bootstrap/AgentBootstrap.java
Outdated
Show resolved
Hide resolved
Yes, this is exactly the issue that I am fixing here :) I tested this with the DD Intellij Plugin repo, and the fix works without the need for additional changes in the project |
Would you be interested in me adding a smoke test for this ? |
Of course, that'd be great! |
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.
LGTM - same comments as @bric3, but no blockers
What Does This Do
Updates agent bootstrap logic to try to locate tracer JAR by finding the
AgentBootstrap.class
resource using the class' classloader.Motivation
Currently the lookup is done using
ProtectionDomain
/CodeSource
and by parsing the-javaagent
argument if the first approach fails.However the second approach may fail too if multiple agents are specified (which, for example, is possible in CI Visibility when a test JVM is forked both with the tracer and with the Jacoco agent).
Jira ticket: CIVIS-7865