-
Notifications
You must be signed in to change notification settings - Fork 300
Supporting Baggage for Instrumentations used in Weblog Tests #8773
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
...rap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/HttpServerDecorator.java
Show resolved
Hide resolved
/* Verify whether we have only span contexts or more contexts */ | ||
public ContextScope activateScope(Context context, AgentSpan span) { | ||
Baggage baggage = Baggage.fromContext(context); | ||
if (baggage == null) { |
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.
@mcculls This is what I understood when you mentioned that we can only use span context if it is the only context that was extracted. Let me know if I interpreted that idea correctly here. 😃
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.
This part feels weird to me. Would need to discuss with @mcculls
- It will drop any other context data than baggage (like DSM or other product)
- If there is no data in context, context will be root, and
root.with(span)
is equals tospan
(no allocation, no perf cost) so this will always be save to usecontext.with(span).attach()
nitpick: And on the semantic side, you are not activating a scope, you are activating a context, which activation results in a scope
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 58 metrics, 13 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.50.0-SNAPSHOT~5ce53bc873, baseline=1.50.0-SNAPSHOT~d5d53cd553
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.025 s) : 0, 1025274
Total [baseline] (10.525 s) : 0, 10524741
Agent [candidate] (1.017 s) : 0, 1017206
Total [candidate] (10.546 s) : 0, 10545612
section appsec
Agent [baseline] (1.166 s) : 0, 1165659
Total [baseline] (10.752 s) : 0, 10752472
Agent [candidate] (1.167 s) : 0, 1167288
Total [candidate] (10.784 s) : 0, 10783586
section iast
Agent [baseline] (1.15 s) : 0, 1149612
Total [baseline] (10.919 s) : 0, 10919057
Agent [candidate] (1.16 s) : 0, 1159803
Total [candidate] (10.987 s) : 0, 10986569
section profiling
Agent [baseline] (1.281 s) : 0, 1281334
Total [baseline] (10.893 s) : 0, 10892924
Agent [candidate] (1.292 s) : 0, 1291727
Total [candidate] (10.883 s) : 0, 10883249
gantt
title petclinic - break down per module: candidate=1.50.0-SNAPSHOT~5ce53bc873, baseline=1.50.0-SNAPSHOT~d5d53cd553
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (685.062 ms) : 0, 685062
BytebuddyAgent [candidate] (681.772 ms) : 0, 681772
GlobalTracer [baseline] (240.937 ms) : 0, 240937
GlobalTracer [candidate] (239.993 ms) : 0, 239993
AppSec [baseline] (54.677 ms) : 0, 54677
AppSec [candidate] (54.311 ms) : 0, 54311
Debugger [baseline] (10.672 ms) : 0, 10672
Debugger [candidate] (7.673 ms) : 0, 7673
Remote Config [baseline] (686.124 µs) : 0, 686
Remote Config [candidate] (706.268 µs) : 0, 706
Telemetry [baseline] (9.774 ms) : 0, 9774
Telemetry [candidate] (9.182 ms) : 0, 9182
section appsec
BytebuddyAgent [baseline] (703.386 ms) : 0, 703386
BytebuddyAgent [candidate] (704.251 ms) : 0, 704251
GlobalTracer [baseline] (237.63 ms) : 0, 237630
GlobalTracer [candidate] (237.89 ms) : 0, 237890
AppSec [baseline] (176.391 ms) : 0, 176391
AppSec [candidate] (175.824 ms) : 0, 175824
Debugger [baseline] (5.946 ms) : 0, 5946
Debugger [candidate] (5.971 ms) : 0, 5971
Remote Config [baseline] (627.922 µs) : 0, 628
Remote Config [candidate] (628.13 µs) : 0, 628
Telemetry [baseline] (7.387 ms) : 0, 7387
Telemetry [candidate] (8.194 ms) : 0, 8194
IAST [baseline] (21.631 ms) : 0, 21631
IAST [candidate] (21.75 ms) : 0, 21750
section iast
BytebuddyAgent [baseline] (802.871 ms) : 0, 802871
BytebuddyAgent [candidate] (810.141 ms) : 0, 810141
GlobalTracer [baseline] (230.657 ms) : 0, 230657
GlobalTracer [candidate] (232.985 ms) : 0, 232985
AppSec [baseline] (49.438 ms) : 0, 49438
AppSec [candidate] (50.472 ms) : 0, 50472
Debugger [baseline] (5.863 ms) : 0, 5863
Debugger [candidate] (5.914 ms) : 0, 5914
Remote Config [baseline] (590.544 µs) : 0, 591
Remote Config [candidate] (600.301 µs) : 0, 600
Telemetry [baseline] (7.818 ms) : 0, 7818
Telemetry [candidate] (7.895 ms) : 0, 7895
IAST [baseline] (28.161 ms) : 0, 28161
IAST [candidate] (26.692 ms) : 0, 26692
section profiling
BytebuddyAgent [baseline] (673.198 ms) : 0, 673198
BytebuddyAgent [candidate] (679.95 ms) : 0, 679950
GlobalTracer [baseline] (378.826 ms) : 0, 378826
GlobalTracer [candidate] (381.661 ms) : 0, 381661
AppSec [baseline] (54.654 ms) : 0, 54654
AppSec [candidate] (54.303 ms) : 0, 54303
Debugger [baseline] (6.188 ms) : 0, 6188
Debugger [candidate] (6.191 ms) : 0, 6191
Remote Config [baseline] (665.987 µs) : 0, 666
Remote Config [candidate] (660.126 µs) : 0, 660
Telemetry [baseline] (8.108 ms) : 0, 8108
Telemetry [candidate] (8.159 ms) : 0, 8159
ProfilingAgent [baseline] (109.14 ms) : 0, 109140
ProfilingAgent [candidate] (109.708 ms) : 0, 109708
Profiling [baseline] (109.165 ms) : 0, 109165
Profiling [candidate] (109.735 ms) : 0, 109735
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.50.0-SNAPSHOT~5ce53bc873, baseline=1.50.0-SNAPSHOT~d5d53cd553
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.024 s) : 0, 1024050
Total [baseline] (8.68 s) : 0, 8680093
Agent [candidate] (1.02 s) : 0, 1019933
Total [candidate] (8.68 s) : 0, 8680178
section iast
Agent [baseline] (1.156 s) : 0, 1156200
Total [baseline] (9.307 s) : 0, 9306537
Agent [candidate] (1.165 s) : 0, 1164939
Total [candidate] (9.383 s) : 0, 9383096
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.146 s) : 0, 1146449
Total [baseline] (9.224 s) : 0, 9223817
Agent [candidate] (1.149 s) : 0, 1148615
Total [candidate] (9.31 s) : 0, 9309894
section iast_TELEMETRY_OFF
Agent [baseline] (1.146 s) : 0, 1146331
Total [baseline] (9.248 s) : 0, 9248433
Agent [candidate] (1.145 s) : 0, 1145390
Total [candidate] (9.317 s) : 0, 9316747
gantt
title insecure-bank - break down per module: candidate=1.50.0-SNAPSHOT~5ce53bc873, baseline=1.50.0-SNAPSHOT~d5d53cd553
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (686.195 ms) : 0, 686195
BytebuddyAgent [candidate] (682.136 ms) : 0, 682136
GlobalTracer [baseline] (241.077 ms) : 0, 241077
GlobalTracer [candidate] (240.306 ms) : 0, 240306
AppSec [baseline] (54.81 ms) : 0, 54810
AppSec [candidate] (54.328 ms) : 0, 54328
Debugger [baseline] (7.722 ms) : 0, 7722
Debugger [candidate] (7.754 ms) : 0, 7754
Remote Config [baseline] (718.24 µs) : 0, 718
Remote Config [candidate] (693.693 µs) : 0, 694
Telemetry [baseline] (9.886 ms) : 0, 9886
Telemetry [candidate] (11.255 ms) : 0, 11255
section iast
BytebuddyAgent [baseline] (806.885 ms) : 0, 806885
BytebuddyAgent [candidate] (814.011 ms) : 0, 814011
GlobalTracer [baseline] (231.714 ms) : 0, 231714
GlobalTracer [candidate] (233.338 ms) : 0, 233338
AppSec [baseline] (50.05 ms) : 0, 50050
AppSec [candidate] (49.746 ms) : 0, 49746
Debugger [baseline] (6.017 ms) : 0, 6017
Debugger [candidate] (5.949 ms) : 0, 5949
Remote Config [baseline] (597.82 µs) : 0, 598
Remote Config [candidate] (594.648 µs) : 0, 595
Telemetry [baseline] (7.992 ms) : 0, 7992
Telemetry [candidate] (7.99 ms) : 0, 7990
IAST [baseline] (28.567 ms) : 0, 28567
IAST [candidate] (29.597 ms) : 0, 29597
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (799.902 ms) : 0, 799902
BytebuddyAgent [candidate] (801.224 ms) : 0, 801224
GlobalTracer [baseline] (230.306 ms) : 0, 230306
GlobalTracer [candidate] (230.833 ms) : 0, 230833
AppSec [baseline] (47.708 ms) : 0, 47708
AppSec [candidate] (49.383 ms) : 0, 49383
Debugger [baseline] (5.86 ms) : 0, 5860
Debugger [candidate] (5.922 ms) : 0, 5922
Remote Config [baseline] (594.62 µs) : 0, 595
Remote Config [candidate] (582.771 µs) : 0, 583
Telemetry [baseline] (7.919 ms) : 0, 7919
Telemetry [candidate] (7.902 ms) : 0, 7902
IAST [baseline] (29.301 ms) : 0, 29301
IAST [candidate] (29.3 ms) : 0, 29300
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (799.697 ms) : 0, 799697
BytebuddyAgent [candidate] (798.875 ms) : 0, 798875
GlobalTracer [baseline] (230.738 ms) : 0, 230738
GlobalTracer [candidate] (230.676 ms) : 0, 230676
AppSec [baseline] (55.762 ms) : 0, 55762
AppSec [candidate] (55.001 ms) : 0, 55001
Debugger [baseline] (5.951 ms) : 0, 5951
Debugger [candidate] (5.989 ms) : 0, 5989
Remote Config [baseline] (610.402 µs) : 0, 610
Remote Config [candidate] (604.244 µs) : 0, 604
Telemetry [baseline] (7.794 ms) : 0, 7794
Telemetry [candidate] (7.804 ms) : 0, 7804
IAST [baseline] (22.314 ms) : 0, 22314
IAST [candidate] (23.036 ms) : 0, 23036
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 0 metrics, 16 unstable metrics. Dacapo |
...rap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/HttpServerDecorator.java
Show resolved
Hide resolved
/* Verify whether we have only span contexts or more contexts */ | ||
public ContextScope activateScope(Context context, AgentSpan span) { | ||
Baggage baggage = Baggage.fromContext(context); | ||
if (baggage == null) { |
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.
This part feels weird to me. Would need to discuss with @mcculls
- It will drop any other context data than baggage (like DSM or other product)
- If there is no data in context, context will be root, and
root.with(span)
is equals tospan
(no allocation, no perf cost) so this will always be save to usecontext.with(span).attach()
nitpick: And on the semantic side, you are not activating a scope, you are activating a context, which activation results in a scope
...c/main/java/datadog/trace/instrumentation/azure/functions/AzureFunctionsInstrumentation.java
Outdated
Show resolved
Hide resolved
...mcat-5.5/src/main/java/datadog/trace/instrumentation/tomcat/TomcatServerInstrumentation.java
Outdated
Show resolved
Hide resolved
e2d8ef7
to
81a9768
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. |
resolve merge conflicts
50f5b7a
to
4cd49f4
Compare
What Does This Do
This PR migrates context propagation from Span contexts to generic Contexts for the instrumentations used in weblog tests (Tomcat on the server-side and okhttp3 on the client-side). This allows us to verify that we can properly propagate generic contexts end-to-end through System-tests verification.
Additionally, this PR introduces more helper methods in the
HttpServerDecorator
in order to reduce repetitive code in the instrumentation advice layer and ensure consistency among how we handle 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]