-
Notifications
You must be signed in to change notification settings - Fork 304
Migrating all HttpServer Instrumentations to Extract full Context #8820
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
Migrating all HttpServer Instrumentations to Extract full Context #8820
Conversation
resolve merge conflicts
BenchmarksStartupParameters
See matching parameters
SummaryFound 3 performance improvements and 1 performance regressions! Performance is the same for 55 metrics, 12 unstable metrics.
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.50.0-SNAPSHOT~4a2be2397b, baseline=1.50.0-SNAPSHOT~ad6d5fef42
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.027 s) : 0, 1026647
Total [baseline] (10.623 s) : 0, 10623000
Agent [candidate] (1.02 s) : 0, 1020202
Total [candidate] (10.503 s) : 0, 10503020
section appsec
Agent [baseline] (1.162 s) : 0, 1162079
Total [baseline] (10.712 s) : 0, 10711539
Agent [candidate] (1.16 s) : 0, 1160134
Total [candidate] (10.653 s) : 0, 10652845
section iast
Agent [baseline] (1.149 s) : 0, 1148516
Total [baseline] (10.835 s) : 0, 10835411
Agent [candidate] (1.151 s) : 0, 1151500
Total [candidate] (10.887 s) : 0, 10887296
section profiling
Agent [baseline] (1.281 s) : 0, 1281457
Total [baseline] (10.909 s) : 0, 10908989
Agent [candidate] (1.266 s) : 0, 1265953
Total [candidate] (10.874 s) : 0, 10873614
gantt
title petclinic - break down per module: candidate=1.50.0-SNAPSHOT~4a2be2397b, baseline=1.50.0-SNAPSHOT~ad6d5fef42
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (687.639 ms) : 0, 687639
BytebuddyAgent [candidate] (683.219 ms) : 0, 683219
GlobalTracer [baseline] (241.059 ms) : 0, 241059
GlobalTracer [candidate] (240.28 ms) : 0, 240280
AppSec [baseline] (54.793 ms) : 0, 54793
AppSec [candidate] (54.485 ms) : 0, 54485
Debugger [baseline] (9.042 ms) : 0, 9042
Debugger [candidate] (8.269 ms) : 0, 8269
Remote Config [baseline] (695.895 µs) : 0, 696
Remote Config [candidate] (692.714 µs) : 0, 693
Telemetry [baseline] (9.817 ms) : 0, 9817
Telemetry [candidate] (9.694 ms) : 0, 9694
section appsec
BytebuddyAgent [baseline] (700.596 ms) : 0, 700596
BytebuddyAgent [candidate] (699.673 ms) : 0, 699673
GlobalTracer [baseline] (237.167 ms) : 0, 237167
GlobalTracer [candidate] (236.581 ms) : 0, 236581
AppSec [baseline] (175.883 ms) : 0, 175883
AppSec [candidate] (175.251 ms) : 0, 175251
Debugger [baseline] (5.971 ms) : 0, 5971
Debugger [candidate] (5.924 ms) : 0, 5924
Remote Config [baseline] (617.716 µs) : 0, 618
Remote Config [candidate] (611.89 µs) : 0, 612
Telemetry [baseline] (7.431 ms) : 0, 7431
Telemetry [candidate] (7.705 ms) : 0, 7705
IAST [baseline] (21.839 ms) : 0, 21839
IAST [candidate] (21.655 ms) : 0, 21655
section iast
BytebuddyAgent [baseline] (802.039 ms) : 0, 802039
BytebuddyAgent [candidate] (803.626 ms) : 0, 803626
GlobalTracer [baseline] (230.109 ms) : 0, 230109
GlobalTracer [candidate] (231.175 ms) : 0, 231175
AppSec [baseline] (49.418 ms) : 0, 49418
AppSec [candidate] (51.24 ms) : 0, 51240
Debugger [baseline] (5.857 ms) : 0, 5857
Debugger [candidate] (5.878 ms) : 0, 5878
Remote Config [baseline] (588.337 µs) : 0, 588
Remote Config [candidate] (592.576 µs) : 0, 593
Telemetry [baseline] (7.814 ms) : 0, 7814
Telemetry [candidate] (7.882 ms) : 0, 7882
IAST [baseline] (29.2 ms) : 0, 29200
IAST [candidate] (27.578 ms) : 0, 27578
section profiling
BytebuddyAgent [baseline] (673.669 ms) : 0, 673669
BytebuddyAgent [candidate] (673.845 ms) : 0, 673845
GlobalTracer [baseline] (378.635 ms) : 0, 378635
GlobalTracer [candidate] (359.942 ms) : 0, 359942
AppSec [baseline] (54.279 ms) : 0, 54279
AppSec [candidate] (62.037 ms) : 0, 62037
Debugger [baseline] (6.166 ms) : 0, 6166
Debugger [candidate] (6.265 ms) : 0, 6265
Remote Config [baseline] (662.293 µs) : 0, 662
Remote Config [candidate] (654.618 µs) : 0, 655
Telemetry [baseline] (8.105 ms) : 0, 8105
Telemetry [candidate] (8.261 ms) : 0, 8261
ProfilingAgent [baseline] (109.372 ms) : 0, 109372
ProfilingAgent [candidate] (104.126 ms) : 0, 104126
Profiling [baseline] (109.397 ms) : 0, 109397
Profiling [candidate] (104.15 ms) : 0, 104150
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.50.0-SNAPSHOT~4a2be2397b, baseline=1.50.0-SNAPSHOT~ad6d5fef42
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.034 s) : 0, 1034145
Total [baseline] (8.683 s) : 0, 8682503
Agent [candidate] (1.023 s) : 0, 1022998
Total [candidate] (8.667 s) : 0, 8666767
section iast
Agent [baseline] (1.152 s) : 0, 1152279
Total [baseline] (9.241 s) : 0, 9241057
Agent [candidate] (1.158 s) : 0, 1158404
Total [candidate] (9.221 s) : 0, 9221104
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.146 s) : 0, 1145595
Total [baseline] (9.188 s) : 0, 9187541
Agent [candidate] (1.155 s) : 0, 1154730
Total [candidate] (9.22 s) : 0, 9219689
section iast_TELEMETRY_OFF
Agent [baseline] (1.145 s) : 0, 1145056
Total [baseline] (9.206 s) : 0, 9206115
Agent [candidate] (1.146 s) : 0, 1146181
Total [candidate] (9.212 s) : 0, 9212379
gantt
title insecure-bank - break down per module: candidate=1.50.0-SNAPSHOT~4a2be2397b, baseline=1.50.0-SNAPSHOT~ad6d5fef42
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (691.463 ms) : 0, 691463
BytebuddyAgent [candidate] (682.788 ms) : 0, 682788
GlobalTracer [baseline] (242.589 ms) : 0, 242589
GlobalTracer [candidate] (240.52 ms) : 0, 240520
AppSec [baseline] (54.941 ms) : 0, 54941
AppSec [candidate] (54.501 ms) : 0, 54501
Debugger [baseline] (11.764 ms) : 0, 11764
Debugger [candidate] (11.231 ms) : 0, 11231
Remote Config [baseline] (677.295 µs) : 0, 677
Remote Config [candidate] (711.871 µs) : 0, 712
Telemetry [baseline] (8.836 ms) : 0, 8836
Telemetry [candidate] (8.985 ms) : 0, 8985
section iast
BytebuddyAgent [baseline] (803.586 ms) : 0, 803586
BytebuddyAgent [candidate] (809.276 ms) : 0, 809276
GlobalTracer [baseline] (231.395 ms) : 0, 231395
GlobalTracer [candidate] (232.386 ms) : 0, 232386
IAST [baseline] (27.698 ms) : 0, 27698
IAST [candidate] (29.269 ms) : 0, 29269
AppSec [baseline] (51.427 ms) : 0, 51427
AppSec [candidate] (49.463 ms) : 0, 49463
Debugger [baseline] (5.992 ms) : 0, 5992
Debugger [candidate] (5.897 ms) : 0, 5897
Remote Config [baseline] (605.247 µs) : 0, 605
Remote Config [candidate] (578.943 µs) : 0, 579
Telemetry [baseline] (7.979 ms) : 0, 7979
Telemetry [candidate] (7.907 ms) : 0, 7907
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (799.72 ms) : 0, 799720
BytebuddyAgent [candidate] (806.776 ms) : 0, 806776
GlobalTracer [baseline] (229.49 ms) : 0, 229490
GlobalTracer [candidate] (231.128 ms) : 0, 231128
IAST [baseline] (30.06 ms) : 0, 30060
IAST [candidate] (29.173 ms) : 0, 29173
AppSec [baseline] (48.498 ms) : 0, 48498
AppSec [candidate] (49.594 ms) : 0, 49594
Debugger [baseline] (5.914 ms) : 0, 5914
Debugger [candidate] (5.911 ms) : 0, 5911
Remote Config [baseline] (593.696 µs) : 0, 594
Remote Config [candidate] (597.038 µs) : 0, 597
Telemetry [baseline] (7.906 ms) : 0, 7906
Telemetry [candidate] (7.892 ms) : 0, 7892
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (798.988 ms) : 0, 798988
BytebuddyAgent [candidate] (799.463 ms) : 0, 799463
GlobalTracer [baseline] (230.432 ms) : 0, 230432
GlobalTracer [candidate] (230.51 ms) : 0, 230510
IAST [baseline] (22.979 ms) : 0, 22979
IAST [candidate] (23.074 ms) : 0, 23074
AppSec [baseline] (54.748 ms) : 0, 54748
AppSec [candidate] (55.251 ms) : 0, 55251
Debugger [baseline] (5.974 ms) : 0, 5974
Debugger [candidate] (5.974 ms) : 0, 5974
Remote Config [baseline] (593.944 µs) : 0, 594
Remote Config [candidate] (601.174 µs) : 0, 601
Telemetry [baseline] (7.793 ms) : 0, 7793
Telemetry [candidate] (7.82 ms) : 0, 7820
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 18 unstable metrics. Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.50.0-SNAPSHOT~4a2be2397b, baseline=1.50.0-SNAPSHOT~ad6d5fef42
dateFormat X
axisFormat %s
section baseline
no_agent (1.357 ms) : 1338, 1377
. : milestone, 1357,
appsec (1.728 ms) : 1705, 1752
. : milestone, 1728,
appsec_no_iast (1.73 ms) : 1706, 1754
. : milestone, 1730,
code_origins (1.657 ms) : 1629, 1684
. : milestone, 1657,
iast (1.508 ms) : 1483, 1532
. : milestone, 1508,
profiling (1.522 ms) : 1498, 1545
. : milestone, 1522,
tracing (1.494 ms) : 1469, 1518
. : milestone, 1494,
section candidate
no_agent (1.38 ms) : 1360, 1399
. : milestone, 1380,
appsec (1.75 ms) : 1726, 1773
. : milestone, 1750,
appsec_no_iast (1.727 ms) : 1704, 1750
. : milestone, 1727,
code_origins (1.669 ms) : 1642, 1696
. : milestone, 1669,
iast (1.518 ms) : 1494, 1542
. : milestone, 1518,
profiling (1.508 ms) : 1484, 1531
. : milestone, 1508,
tracing (1.492 ms) : 1466, 1517
. : milestone, 1492,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.50.0-SNAPSHOT~4a2be2397b, baseline=1.50.0-SNAPSHOT~ad6d5fef42
dateFormat X
axisFormat %s
section baseline
no_agent (380.041 µs) : 360, 400
. : milestone, 380,
iast (518.505 µs) : 496, 541
. : milestone, 519,
iast_FULL (729.925 µs) : 708, 752
. : milestone, 730,
iast_GLOBAL (560.679 µs) : 538, 583
. : milestone, 561,
iast_HARDCODED_SECRET_DISABLED (506.728 µs) : 485, 528
. : milestone, 507,
iast_INACTIVE (466.269 µs) : 444, 489
. : milestone, 466,
iast_TELEMETRY_OFF (521.08 µs) : 498, 544
. : milestone, 521,
tracing (452.288 µs) : 430, 474
. : milestone, 452,
section candidate
no_agent (380.429 µs) : 361, 400
. : milestone, 380,
iast (516.282 µs) : 495, 538
. : milestone, 516,
iast_FULL (735.782 µs) : 714, 758
. : milestone, 736,
iast_GLOBAL (567.315 µs) : 545, 590
. : milestone, 567,
iast_HARDCODED_SECRET_DISABLED (529.771 µs) : 506, 553
. : milestone, 530,
iast_INACTIVE (464.704 µs) : 442, 487
. : milestone, 465,
iast_TELEMETRY_OFF (500.944 µs) : 478, 524
. : milestone, 501,
tracing (457.071 µs) : 435, 479
. : milestone, 457,
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.50.0-SNAPSHOT~4a2be2397b, baseline=1.50.0-SNAPSHOT~ad6d5fef42
dateFormat X
axisFormat %s
section baseline
no_agent (1.481 ms) : 1470, 1493
. : milestone, 1481,
appsec (2.409 ms) : 2361, 2458
. : milestone, 2409,
iast (2.187 ms) : 2126, 2248
. : milestone, 2187,
iast_GLOBAL (2.229 ms) : 2167, 2290
. : milestone, 2229,
profiling (2.514 ms) : 2330, 2698
. : milestone, 2514,
tracing (2.018 ms) : 1971, 2066
. : milestone, 2018,
section candidate
no_agent (1.482 ms) : 1471, 1494
. : milestone, 1482,
appsec (2.412 ms) : 2363, 2461
. : milestone, 2412,
iast (2.198 ms) : 2136, 2260
. : milestone, 2198,
iast_GLOBAL (2.232 ms) : 2170, 2293
. : milestone, 2232,
profiling (2.035 ms) : 1986, 2084
. : milestone, 2035,
tracing (2.03 ms) : 1982, 2078
. : milestone, 2030,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.50.0-SNAPSHOT~4a2be2397b, baseline=1.50.0-SNAPSHOT~ad6d5fef42
dateFormat X
axisFormat %s
section baseline
no_agent (15.487 s) : 15487000, 15487000
. : milestone, 15487000,
appsec (15.182 s) : 15182000, 15182000
. : milestone, 15182000,
iast (18.5 s) : 18500000, 18500000
. : milestone, 18500000,
iast_GLOBAL (18.22 s) : 18220000, 18220000
. : milestone, 18220000,
profiling (14.808 s) : 14808000, 14808000
. : milestone, 14808000,
tracing (15.031 s) : 15031000, 15031000
. : milestone, 15031000,
section candidate
no_agent (14.786 s) : 14786000, 14786000
. : milestone, 14786000,
appsec (15.189 s) : 15189000, 15189000
. : milestone, 15189000,
iast (19.266 s) : 19266000, 19266000
. : milestone, 19266000,
iast_GLOBAL (18.063 s) : 18063000, 18063000
. : milestone, 18063000,
profiling (14.95 s) : 14950000, 14950000
. : milestone, 14950000,
tracing (14.765 s) : 14765000, 14765000
. : milestone, 14765000,
|
Context
and ContextScope
Context
and ContextScope
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.
Forgot to submit my comment 😅
...rap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/HttpServerDecorator.java
Outdated
Show resolved
Hide resolved
2a6d442
to
4e94f29
Compare
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
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 will have a look more in depth by the end of the week
...rap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/HttpServerDecorator.java
Outdated
Show resolved
Hide resolved
...rap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/HttpServerDecorator.java
Outdated
Show resolved
Hide resolved
...rap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/HttpServerDecorator.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.
Looking good! So far I only found a possible NPE to fix before merging 😅
@@ -111,14 +111,15 @@ public void onDownstreamFinish() throws Exception { | |||
@Override | |||
public void onPush() throws Exception { | |||
final HttpResponse response = grab(responseInlet); | |||
final AgentScope scope = scopes.poll(); | |||
final ContextScope scope = scopes.poll(); | |||
AgentSpan span = AgentSpan.fromContext(scope.context()); |
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.
scope
can be null
and this will cause an NPE
What Does This Do
Migrate all Http Server Instrumentations to extract full
Context
. This PR adds functions inHttpServerDecorator.java
to use a fullContext
in all instrumentation decorator calls. Additionally, it replaces the usage ofactivateSpan
andAgentScope
toContext.attach()
andContextScope
to allow thescopeStack
to track full Context rather than just SpanContexts.Once merged, a follow-up PR will be opened to remove all Http Server decorator calls that were based upon Span Contexts. The new Context-based decorator functions will be used instead.
This PR enables full W3C Baggage extraction for all Http Server instrumentations.
Motivation
Additional Notes
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: [PROJ-IDENT]