-
Notifications
You must be signed in to change notification settings - Fork 303
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
base: master
Are you sure you want to change the base?
Conversation
resolve merge conflicts
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 54 metrics, 17 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.50.0-SNAPSHOT~80529d3a40, baseline=1.50.0-SNAPSHOT~0ebd52ba72
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.026 s) : 0, 1025659
Total [baseline] (10.498 s) : 0, 10498071
Agent [candidate] (1.027 s) : 0, 1027164
Total [candidate] (10.528 s) : 0, 10528171
section appsec
Agent [baseline] (1.163 s) : 0, 1162622
Total [baseline] (10.755 s) : 0, 10755274
Agent [candidate] (1.168 s) : 0, 1167676
Total [candidate] (10.719 s) : 0, 10719365
section iast
Agent [baseline] (1.161 s) : 0, 1160787
Total [baseline] (11.05 s) : 0, 11050165
Agent [candidate] (1.148 s) : 0, 1147890
Total [candidate] (10.867 s) : 0, 10867289
section profiling
Agent [baseline] (1.279 s) : 0, 1279021
Total [baseline] (10.84 s) : 0, 10839852
Agent [candidate] (1.278 s) : 0, 1278381
Total [candidate] (10.857 s) : 0, 10856922
gantt
title petclinic - break down per module: candidate=1.50.0-SNAPSHOT~80529d3a40, baseline=1.50.0-SNAPSHOT~0ebd52ba72
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (687.163 ms) : 0, 687163
BytebuddyAgent [candidate] (686.814 ms) : 0, 686814
GlobalTracer [baseline] (241.453 ms) : 0, 241453
GlobalTracer [candidate] (241.346 ms) : 0, 241346
AppSec [baseline] (54.908 ms) : 0, 54908
AppSec [candidate] (55.554 ms) : 0, 55554
Debugger [baseline] (6.969 ms) : 0, 6969
Debugger [candidate] (7.764 ms) : 0, 7764
Remote Config [baseline] (723.453 µs) : 0, 723
Remote Config [candidate] (710.183 µs) : 0, 710
Telemetry [baseline] (10.729 ms) : 0, 10729
Telemetry [candidate] (11.47 ms) : 0, 11470
section appsec
BytebuddyAgent [baseline] (701.309 ms) : 0, 701309
BytebuddyAgent [candidate] (704.374 ms) : 0, 704374
GlobalTracer [baseline] (236.951 ms) : 0, 236951
GlobalTracer [candidate] (238.04 ms) : 0, 238040
AppSec [baseline] (175.815 ms) : 0, 175815
AppSec [candidate] (176.331 ms) : 0, 176331
Debugger [baseline] (5.938 ms) : 0, 5938
Debugger [candidate] (5.946 ms) : 0, 5946
Remote Config [baseline] (638.516 µs) : 0, 639
Remote Config [candidate] (629.374 µs) : 0, 629
Telemetry [baseline] (7.386 ms) : 0, 7386
Telemetry [candidate] (7.738 ms) : 0, 7738
IAST [baseline] (21.863 ms) : 0, 21863
IAST [candidate] (21.926 ms) : 0, 21926
section iast
BytebuddyAgent [baseline] (809.89 ms) : 0, 809890
BytebuddyAgent [candidate] (800.727 ms) : 0, 800727
GlobalTracer [baseline] (232.287 ms) : 0, 232287
GlobalTracer [candidate] (230.58 ms) : 0, 230580
AppSec [baseline] (51.381 ms) : 0, 51381
AppSec [candidate] (50.285 ms) : 0, 50285
Debugger [baseline] (6.045 ms) : 0, 6045
Debugger [candidate] (5.924 ms) : 0, 5924
Remote Config [baseline] (647.839 µs) : 0, 648
Remote Config [candidate] (589.689 µs) : 0, 590
Telemetry [baseline] (8.111 ms) : 0, 8111
Telemetry [candidate] (7.881 ms) : 0, 7881
IAST [baseline] (28.704 ms) : 0, 28704
IAST [candidate] (28.41 ms) : 0, 28410
section profiling
ProfilingAgent [baseline] (102.773 ms) : 0, 102773
ProfilingAgent [candidate] (103.013 ms) : 0, 103013
BytebuddyAgent [baseline] (673.608 ms) : 0, 673608
BytebuddyAgent [candidate] (673.077 ms) : 0, 673077
GlobalTracer [baseline] (374.886 ms) : 0, 374886
GlobalTracer [candidate] (374.658 ms) : 0, 374658
AppSec [baseline] (61.788 ms) : 0, 61788
AppSec [candidate] (61.675 ms) : 0, 61675
Debugger [baseline] (6.303 ms) : 0, 6303
Debugger [candidate] (6.272 ms) : 0, 6272
Remote Config [baseline] (663.569 µs) : 0, 664
Remote Config [candidate] (660.306 µs) : 0, 660
Telemetry [baseline] (8.218 ms) : 0, 8218
Telemetry [candidate] (8.198 ms) : 0, 8198
Profiling [baseline] (102.797 ms) : 0, 102797
Profiling [candidate] (103.037 ms) : 0, 103037
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.50.0-SNAPSHOT~80529d3a40, baseline=1.50.0-SNAPSHOT~0ebd52ba72
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.035 s) : 0, 1034649
Total [baseline] (8.659 s) : 0, 8659306
Agent [candidate] (1.023 s) : 0, 1022611
Total [candidate] (8.665 s) : 0, 8664772
section iast
Agent [baseline] (1.148 s) : 0, 1147908
Total [baseline] (9.218 s) : 0, 9217941
Agent [candidate] (1.154 s) : 0, 1153929
Total [candidate] (9.241 s) : 0, 9240729
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.158 s) : 0, 1158202
Total [baseline] (9.173 s) : 0, 9172924
Agent [candidate] (1.148 s) : 0, 1147862
Total [candidate] (9.184 s) : 0, 9183551
section iast_TELEMETRY_OFF
Agent [baseline] (1.144 s) : 0, 1144471
Total [baseline] (9.219 s) : 0, 9218790
Agent [candidate] (1.162 s) : 0, 1162458
Total [candidate] (9.245 s) : 0, 9245250
gantt
title insecure-bank - break down per module: candidate=1.50.0-SNAPSHOT~80529d3a40, baseline=1.50.0-SNAPSHOT~0ebd52ba72
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (690.955 ms) : 0, 690955
BytebuddyAgent [candidate] (684.029 ms) : 0, 684029
GlobalTracer [baseline] (242.511 ms) : 0, 242511
GlobalTracer [candidate] (241.9 ms) : 0, 241900
AppSec [baseline] (56.468 ms) : 0, 56468
AppSec [candidate] (54.743 ms) : 0, 54743
Debugger [baseline] (8.318 ms) : 0, 8318
Debugger [candidate] (7.626 ms) : 0, 7626
Remote Config [baseline] (691.103 µs) : 0, 691
Remote Config [candidate] (704.512 µs) : 0, 705
Telemetry [baseline] (11.97 ms) : 0, 11970
Telemetry [candidate] (10.016 ms) : 0, 10016
section iast
BytebuddyAgent [baseline] (801.496 ms) : 0, 801496
BytebuddyAgent [candidate] (804.745 ms) : 0, 804745
GlobalTracer [baseline] (230.214 ms) : 0, 230214
GlobalTracer [candidate] (231.863 ms) : 0, 231863
IAST [baseline] (29.049 ms) : 0, 29049
IAST [candidate] (27.662 ms) : 0, 27662
AppSec [baseline] (49.332 ms) : 0, 49332
AppSec [candidate] (50.912 ms) : 0, 50912
Debugger [baseline] (5.885 ms) : 0, 5885
Debugger [candidate] (5.932 ms) : 0, 5932
Remote Config [baseline] (587.715 µs) : 0, 588
Remote Config [candidate] (621.227 µs) : 0, 621
Telemetry [baseline] (7.835 ms) : 0, 7835
Telemetry [candidate] (7.879 ms) : 0, 7879
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (808.777 ms) : 0, 808777
BytebuddyAgent [candidate] (800.186 ms) : 0, 800186
GlobalTracer [baseline] (232.191 ms) : 0, 232191
GlobalTracer [candidate] (230.73 ms) : 0, 230730
IAST [baseline] (26.93 ms) : 0, 26930
IAST [candidate] (28.613 ms) : 0, 28613
AppSec [baseline] (51.36 ms) : 0, 51360
AppSec [candidate] (50.435 ms) : 0, 50435
Debugger [baseline] (5.948 ms) : 0, 5948
Debugger [candidate] (5.946 ms) : 0, 5946
Remote Config [baseline] (591.048 µs) : 0, 591
Remote Config [candidate] (596.947 µs) : 0, 597
Telemetry [baseline] (7.959 ms) : 0, 7959
Telemetry [candidate] (7.912 ms) : 0, 7912
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (797.461 ms) : 0, 797461
BytebuddyAgent [candidate] (809.81 ms) : 0, 809810
GlobalTracer [baseline] (230.493 ms) : 0, 230493
GlobalTracer [candidate] (234.503 ms) : 0, 234503
IAST [baseline] (23.059 ms) : 0, 23059
IAST [candidate] (23.704 ms) : 0, 23704
AppSec [baseline] (55.455 ms) : 0, 55455
AppSec [candidate] (56.032 ms) : 0, 56032
Debugger [baseline] (6.055 ms) : 0, 6055
Debugger [candidate] (6.045 ms) : 0, 6045
Remote Config [baseline] (608.356 µs) : 0, 608
Remote Config [candidate] (611.538 µs) : 0, 612
Telemetry [baseline] (7.845 ms) : 0, 7845
Telemetry [candidate] (7.881 ms) : 0, 7881
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 insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.50.0-SNAPSHOT~80529d3a40, baseline=1.50.0-SNAPSHOT~0ebd52ba72
dateFormat X
axisFormat %s
section baseline
no_agent (373.832 µs) : 354, 393
. : milestone, 374,
iast (516.04 µs) : 493, 539
. : milestone, 516,
iast_FULL (730.142 µs) : 708, 752
. : milestone, 730,
iast_GLOBAL (569.313 µs) : 546, 593
. : milestone, 569,
iast_HARDCODED_SECRET_DISABLED (522.846 µs) : 500, 546
. : milestone, 523,
iast_INACTIVE (459.518 µs) : 437, 482
. : milestone, 460,
iast_TELEMETRY_OFF (506.815 µs) : 483, 530
. : milestone, 507,
tracing (452.089 µs) : 430, 474
. : milestone, 452,
section candidate
no_agent (383.498 µs) : 364, 403
. : milestone, 383,
iast (518.69 µs) : 497, 540
. : milestone, 519,
iast_FULL (731.134 µs) : 709, 753
. : milestone, 731,
iast_GLOBAL (564.235 µs) : 542, 587
. : milestone, 564,
iast_HARDCODED_SECRET_DISABLED (519.293 µs) : 496, 543
. : milestone, 519,
iast_INACTIVE (460.761 µs) : 439, 482
. : milestone, 461,
iast_TELEMETRY_OFF (510.765 µs) : 488, 534
. : milestone, 511,
tracing (459.676 µs) : 438, 482
. : milestone, 460,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.50.0-SNAPSHOT~80529d3a40, baseline=1.50.0-SNAPSHOT~0ebd52ba72
dateFormat X
axisFormat %s
section baseline
no_agent (1.357 ms) : 1338, 1376
. : milestone, 1357,
appsec (1.717 ms) : 1693, 1741
. : milestone, 1717,
appsec_no_iast (1.726 ms) : 1703, 1750
. : milestone, 1726,
code_origins (1.662 ms) : 1636, 1689
. : milestone, 1662,
iast (1.512 ms) : 1488, 1536
. : milestone, 1512,
profiling (1.563 ms) : 1538, 1587
. : milestone, 1563,
tracing (1.487 ms) : 1463, 1510
. : milestone, 1487,
section candidate
no_agent (1.347 ms) : 1328, 1366
. : milestone, 1347,
appsec (1.734 ms) : 1711, 1757
. : milestone, 1734,
appsec_no_iast (1.728 ms) : 1704, 1751
. : milestone, 1728,
code_origins (1.671 ms) : 1645, 1698
. : milestone, 1671,
iast (1.513 ms) : 1488, 1538
. : milestone, 1513,
profiling (1.506 ms) : 1482, 1530
. : milestone, 1506,
tracing (1.481 ms) : 1456, 1506
. : milestone, 1481,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.50.0-SNAPSHOT~80529d3a40, baseline=1.50.0-SNAPSHOT~0ebd52ba72
dateFormat X
axisFormat %s
section baseline
no_agent (1.473 ms) : 1462, 1485
. : milestone, 1473,
appsec (2.392 ms) : 2342, 2441
. : milestone, 2392,
iast (2.18 ms) : 2118, 2242
. : milestone, 2180,
iast_GLOBAL (2.224 ms) : 2162, 2286
. : milestone, 2224,
profiling (2.042 ms) : 1990, 2093
. : milestone, 2042,
tracing (2.004 ms) : 1956, 2052
. : milestone, 2004,
section candidate
no_agent (1.47 ms) : 1459, 1482
. : milestone, 1470,
appsec (2.396 ms) : 2347, 2446
. : milestone, 2396,
iast (2.184 ms) : 2122, 2247
. : milestone, 2184,
iast_GLOBAL (2.225 ms) : 2163, 2287
. : milestone, 2225,
profiling (2.03 ms) : 1980, 2079
. : milestone, 2030,
tracing (1.996 ms) : 1948, 2044
. : milestone, 1996,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.50.0-SNAPSHOT~80529d3a40, baseline=1.50.0-SNAPSHOT~0ebd52ba72
dateFormat X
axisFormat %s
section baseline
no_agent (14.93 s) : 14930000, 14930000
. : milestone, 14930000,
appsec (14.983 s) : 14983000, 14983000
. : milestone, 14983000,
iast (18.926 s) : 18926000, 18926000
. : milestone, 18926000,
iast_GLOBAL (18.056 s) : 18056000, 18056000
. : milestone, 18056000,
profiling (15.421 s) : 15421000, 15421000
. : milestone, 15421000,
tracing (14.987 s) : 14987000, 14987000
. : milestone, 14987000,
section candidate
no_agent (15.466 s) : 15466000, 15466000
. : milestone, 15466000,
appsec (15.142 s) : 15142000, 15142000
. : milestone, 15142000,
iast (18.797 s) : 18797000, 18797000
. : milestone, 18797000,
iast_GLOBAL (18.202 s) : 18202000, 18202000
. : milestone, 18202000,
profiling (15.156 s) : 15156000, 15156000
. : milestone, 15156000,
tracing (14.976 s) : 14976000, 14976000
. : milestone, 14976000,
|
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 😅
return extractedSpan == null ? null : (AgentSpanContext.Extracted) extractedSpan.context(); | ||
} | ||
|
||
public AgentSpan onRequestWithContext( |
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.
Can be named onRequest
. It won't conflict as the parameters are different.
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.
@PerfectSlayer there is actually an issue with onRequest
where they pass in null
as a context, which then leads to the compiler being confused about which which function to use 🤔
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.
Was it null
as the new API Context
or as AgentSpan.Extracted
?
For Context
, it should never be null
but root()
instead.
For AgentSpan.Extracted
, you may hint the compiler by using (AgentSpan.Extracted) null
-- not ideal but the issue is more on using null arg than casting them 😇
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 don't think there are any direct passing of null
. When a context gets extracted in instrumentation handlers, the context gets passed to onRequest
, but if the value is null
, then there is no way to know which one implementation to call. Is there a way to bypass this?
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.
You can always cast to (AgentSpan.Extracted)
when you know you expect this type.
But for the runtime to be indecisive, I would expect the var type to be not strongly typed (like Object). Can you point me to the code that was failing so I can have a look?
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 incorrect. There are calls to onRequest
with null
being passed in.
2a6d442
to
4e94f29
Compare
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]