-
Notifications
You must be signed in to change notification settings - Fork 291
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
Introduce a shared context component, independent of tracing. #8117
Conversation
c083482
to
4863c40
Compare
4863c40
to
83176e3
Compare
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.
Most of the comments are related to documentation or visibility.
Another thing I would like to add is the support of toString()
on the Context
implementations. I find it very useful for debugging.
/** Immutable context scoped to an execution unit or carrier object. */ | ||
public interface Context { | ||
|
||
/** Returns the root 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.
Should we define what root
context is supposed to be?
Like the default, minimal context, used as based for any other.
<T> T get(ContextKey<T> key); | ||
|
||
/** | ||
* Creates a new context with the given key-value mapping. |
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.
We should document the expected behavior:
- This will append values from the current instance,
- This will replace if the key already exist,
- What should happen if the value is
null
?
<T> Context with(ContextKey<T> key, T value); | ||
|
||
/** | ||
* Creates a new context with a value that has its own implicit key. |
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.
Similarly, we should be document the append with current values behavior and what the replacement if a current value is already present.
components/context/src/main/java/datadog/context/ContextBinder.java
Outdated
Show resolved
Hide resolved
components/context/src/main/java/datadog/context/ContextManager.java
Outdated
Show resolved
Hide resolved
components/context/src/main/java/datadog/context/ThreadLocalContextManager.java
Show resolved
Hide resolved
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 61 metrics, 2 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.45.0-SNAPSHOT~f93396d7b6, baseline=1.45.0-SNAPSHOT~e8e9292d06
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.059 s) : 0, 1059177
Total [baseline] (10.443 s) : 0, 10443348
Agent [candidate] (1.055 s) : 0, 1055119
Total [candidate] (10.408 s) : 0, 10408049
section appsec
Agent [baseline] (1.193 s) : 0, 1192964
Total [baseline] (10.663 s) : 0, 10662617
Agent [candidate] (1.188 s) : 0, 1188219
Total [candidate] (10.706 s) : 0, 10705503
section iast
Agent [baseline] (1.177 s) : 0, 1176592
Total [baseline] (10.93 s) : 0, 10930144
Agent [candidate] (1.179 s) : 0, 1179175
Total [candidate] (10.958 s) : 0, 10957683
section profiling
Agent [baseline] (1.271 s) : 0, 1271257
Total [baseline] (10.821 s) : 0, 10821443
Agent [candidate] (1.274 s) : 0, 1274387
Total [candidate] (10.832 s) : 0, 10831629
gantt
title petclinic - break down per module: candidate=1.45.0-SNAPSHOT~f93396d7b6, baseline=1.45.0-SNAPSHOT~e8e9292d06
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (716.611 ms) : 0, 716611
BytebuddyAgent [candidate] (713.39 ms) : 0, 713390
GlobalTracer [baseline] (257.144 ms) : 0, 257144
GlobalTracer [candidate] (256.591 ms) : 0, 256591
AppSec [baseline] (56.921 ms) : 0, 56921
AppSec [candidate] (56.601 ms) : 0, 56601
Remote Config [baseline] (695.046 µs) : 0, 695
Remote Config [candidate] (684.019 µs) : 0, 684
Telemetry [baseline] (12.835 ms) : 0, 12835
Telemetry [candidate] (12.774 ms) : 0, 12774
section appsec
BytebuddyAgent [baseline] (733.323 ms) : 0, 733323
BytebuddyAgent [candidate] (730.385 ms) : 0, 730385
GlobalTracer [baseline] (254.395 ms) : 0, 254395
GlobalTracer [candidate] (253.624 ms) : 0, 253624
AppSec [baseline] (171.811 ms) : 0, 171811
AppSec [candidate] (170.818 ms) : 0, 170818
Remote Config [baseline] (663.426 µs) : 0, 663
Remote Config [candidate] (659.85 µs) : 0, 660
Telemetry [baseline] (8.016 ms) : 0, 8016
Telemetry [candidate] (8.003 ms) : 0, 8003
IAST [baseline] (19.578 ms) : 0, 19578
IAST [candidate] (19.44 ms) : 0, 19440
section iast
BytebuddyAgent [baseline] (827.426 ms) : 0, 827426
BytebuddyAgent [candidate] (829.493 ms) : 0, 829493
GlobalTracer [baseline] (246.16 ms) : 0, 246160
GlobalTracer [candidate] (246.751 ms) : 0, 246751
AppSec [baseline] (57.661 ms) : 0, 57661
AppSec [candidate] (57.933 ms) : 0, 57933
Remote Config [baseline] (668.994 µs) : 0, 669
Remote Config [candidate] (646.923 µs) : 0, 647
Telemetry [baseline] (8.497 ms) : 0, 8497
Telemetry [candidate] (8.404 ms) : 0, 8404
IAST [baseline] (21.312 ms) : 0, 21312
IAST [candidate] (20.997 ms) : 0, 20997
section profiling
BytebuddyAgent [baseline] (699.941 ms) : 0, 699941
BytebuddyAgent [candidate] (702.371 ms) : 0, 702371
GlobalTracer [baseline] (371.536 ms) : 0, 371536
GlobalTracer [candidate] (372.066 ms) : 0, 372066
AppSec [baseline] (53.968 ms) : 0, 53968
AppSec [candidate] (53.909 ms) : 0, 53909
Remote Config [baseline] (658.084 µs) : 0, 658
Remote Config [candidate] (661.134 µs) : 0, 661
Telemetry [baseline] (7.866 ms) : 0, 7866
Telemetry [candidate] (7.863 ms) : 0, 7863
ProfilingAgent [baseline] (95.674 ms) : 0, 95674
ProfilingAgent [candidate] (95.596 ms) : 0, 95596
Profiling [baseline] (95.698 ms) : 0, 95698
Profiling [candidate] (95.62 ms) : 0, 95620
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.45.0-SNAPSHOT~f93396d7b6, baseline=1.45.0-SNAPSHOT~e8e9292d06
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.055 s) : 0, 1054882
Total [baseline] (8.578 s) : 0, 8578096
Agent [candidate] (1.057 s) : 0, 1057309
Total [candidate] (8.6 s) : 0, 8599677
section iast
Agent [baseline] (1.177 s) : 0, 1177421
Total [baseline] (9.181 s) : 0, 9181029
Agent [candidate] (1.179 s) : 0, 1178953
Total [candidate] (9.204 s) : 0, 9203876
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.175 s) : 0, 1175214
Total [baseline] (9.133 s) : 0, 9133261
Agent [candidate] (1.177 s) : 0, 1177239
Total [candidate] (9.179 s) : 0, 9179173
section iast_TELEMETRY_OFF
Agent [baseline] (1.172 s) : 0, 1171684
Total [baseline] (9.159 s) : 0, 9158937
Agent [candidate] (1.174 s) : 0, 1173983
Total [candidate] (9.176 s) : 0, 9175757
gantt
title insecure-bank - break down per module: candidate=1.45.0-SNAPSHOT~f93396d7b6, baseline=1.45.0-SNAPSHOT~e8e9292d06
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (712.097 ms) : 0, 712097
BytebuddyAgent [candidate] (714.765 ms) : 0, 714765
GlobalTracer [baseline] (255.896 ms) : 0, 255896
GlobalTracer [candidate] (257.427 ms) : 0, 257427
AppSec [baseline] (57.872 ms) : 0, 57872
AppSec [candidate] (56.731 ms) : 0, 56731
Remote Config [baseline] (684.568 µs) : 0, 685
Remote Config [candidate] (703.552 µs) : 0, 704
Telemetry [baseline] (13.359 ms) : 0, 13359
Telemetry [candidate] (12.748 ms) : 0, 12748
section iast
BytebuddyAgent [baseline] (828.668 ms) : 0, 828668
BytebuddyAgent [candidate] (829.157 ms) : 0, 829157
GlobalTracer [baseline] (246.155 ms) : 0, 246155
GlobalTracer [candidate] (246.63 ms) : 0, 246630
AppSec [baseline] (57.466 ms) : 0, 57466
AppSec [candidate] (57.657 ms) : 0, 57657
Remote Config [baseline] (658.039 µs) : 0, 658
Remote Config [candidate] (660.402 µs) : 0, 660
Telemetry [baseline] (8.446 ms) : 0, 8446
Telemetry [candidate] (8.518 ms) : 0, 8518
IAST [baseline] (21.041 ms) : 0, 21041
IAST [candidate] (21.388 ms) : 0, 21388
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (826.352 ms) : 0, 826352
BytebuddyAgent [candidate] (827.511 ms) : 0, 827511
GlobalTracer [baseline] (246.15 ms) : 0, 246150
GlobalTracer [candidate] (246.565 ms) : 0, 246565
AppSec [baseline] (57.646 ms) : 0, 57646
AppSec [candidate] (57.836 ms) : 0, 57836
Remote Config [baseline] (644.859 µs) : 0, 645
Remote Config [candidate] (661.217 µs) : 0, 661
Telemetry [baseline] (8.483 ms) : 0, 8483
Telemetry [candidate] (8.525 ms) : 0, 8525
IAST [baseline] (21.074 ms) : 0, 21074
IAST [candidate] (21.239 ms) : 0, 21239
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (823.284 ms) : 0, 823284
BytebuddyAgent [candidate] (825.03 ms) : 0, 825030
GlobalTracer [baseline] (246.085 ms) : 0, 246085
GlobalTracer [candidate] (246.923 ms) : 0, 246923
AppSec [baseline] (57.739 ms) : 0, 57739
AppSec [candidate] (57.394 ms) : 0, 57394
Remote Config [baseline] (643.208 µs) : 0, 643
Remote Config [candidate] (648.548 µs) : 0, 649
Telemetry [baseline] (8.287 ms) : 0, 8287
Telemetry [candidate] (8.272 ms) : 0, 8272
IAST [baseline] (20.677 ms) : 0, 20677
IAST [candidate] (20.777 ms) : 0, 20777
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 16 unstable metrics. Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.45.0-SNAPSHOT~f93396d7b6, baseline=1.45.0-SNAPSHOT~e8e9292d06
dateFormat X
axisFormat %s
section baseline
no_agent (1.375 ms) : 1355, 1396
. : milestone, 1375,
appsec (1.742 ms) : 1718, 1766
. : milestone, 1742,
appsec_no_iast (1.783 ms) : 1759, 1808
. : milestone, 1783,
iast (1.527 ms) : 1503, 1550
. : milestone, 1527,
profiling (1.55 ms) : 1524, 1575
. : milestone, 1550,
tracing (1.483 ms) : 1457, 1508
. : milestone, 1483,
section candidate
no_agent (1.358 ms) : 1338, 1377
. : milestone, 1358,
appsec (1.759 ms) : 1735, 1783
. : milestone, 1759,
appsec_no_iast (1.783 ms) : 1758, 1807
. : milestone, 1783,
iast (1.511 ms) : 1489, 1533
. : milestone, 1511,
profiling (1.523 ms) : 1501, 1546
. : milestone, 1523,
tracing (1.482 ms) : 1457, 1506
. : milestone, 1482,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.45.0-SNAPSHOT~f93396d7b6, baseline=1.45.0-SNAPSHOT~e8e9292d06
dateFormat X
axisFormat %s
section baseline
no_agent (380.29 µs) : 360, 401
. : milestone, 380,
iast (503.043 µs) : 482, 524
. : milestone, 503,
iast_FULL (659.43 µs) : 637, 682
. : milestone, 659,
iast_GLOBAL (533.864 µs) : 512, 556
. : milestone, 534,
iast_HARDCODED_SECRET_DISABLED (499.849 µs) : 478, 522
. : milestone, 500,
iast_INACTIVE (467.282 µs) : 445, 489
. : milestone, 467,
iast_TELEMETRY_OFF (485.47 µs) : 464, 507
. : milestone, 485,
tracing (453.034 µs) : 432, 474
. : milestone, 453,
section candidate
no_agent (384.399 µs) : 365, 404
. : milestone, 384,
iast (496.318 µs) : 475, 518
. : milestone, 496,
iast_FULL (658.936 µs) : 637, 681
. : milestone, 659,
iast_GLOBAL (527.569 µs) : 505, 550
. : milestone, 528,
iast_HARDCODED_SECRET_DISABLED (495.343 µs) : 474, 517
. : milestone, 495,
iast_INACTIVE (467.688 µs) : 446, 489
. : milestone, 468,
iast_TELEMETRY_OFF (494.904 µs) : 473, 517
. : milestone, 495,
tracing (453.727 µs) : 433, 475
. : milestone, 454,
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 biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.45.0-SNAPSHOT~f93396d7b6, baseline=1.45.0-SNAPSHOT~e8e9292d06
dateFormat X
axisFormat %s
section baseline
no_agent (14.948 s) : 14948000, 14948000
. : milestone, 14948000,
appsec (14.965 s) : 14965000, 14965000
. : milestone, 14965000,
iast (18.78 s) : 18780000, 18780000
. : milestone, 18780000,
iast_GLOBAL (17.918 s) : 17918000, 17918000
. : milestone, 17918000,
profiling (15.054 s) : 15054000, 15054000
. : milestone, 15054000,
tracing (14.92 s) : 14920000, 14920000
. : milestone, 14920000,
section candidate
no_agent (15.582 s) : 15582000, 15582000
. : milestone, 15582000,
appsec (15.136 s) : 15136000, 15136000
. : milestone, 15136000,
iast (19.005 s) : 19005000, 19005000
. : milestone, 19005000,
iast_GLOBAL (17.811 s) : 17811000, 17811000
. : milestone, 17811000,
profiling (15.185 s) : 15185000, 15185000
. : milestone, 15185000,
tracing (14.883 s) : 14883000, 14883000
. : milestone, 14883000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.45.0-SNAPSHOT~f93396d7b6, baseline=1.45.0-SNAPSHOT~e8e9292d06
dateFormat X
axisFormat %s
section baseline
no_agent (1.467 ms) : 1456, 1479
. : milestone, 1467,
appsec (2.349 ms) : 2307, 2391
. : milestone, 2349,
iast (2.087 ms) : 2034, 2139
. : milestone, 2087,
iast_GLOBAL (2.135 ms) : 2081, 2189
. : milestone, 2135,
profiling (1.973 ms) : 1930, 2017
. : milestone, 1973,
tracing (1.926 ms) : 1886, 1966
. : milestone, 1926,
section candidate
no_agent (1.468 ms) : 1456, 1479
. : milestone, 1468,
appsec (2.343 ms) : 2301, 2384
. : milestone, 2343,
iast (2.082 ms) : 2030, 2135
. : milestone, 2082,
iast_GLOBAL (2.124 ms) : 2071, 2177
. : milestone, 2124,
profiling (1.954 ms) : 1911, 1997
. : milestone, 1954,
tracing (1.935 ms) : 1894, 1976
. : milestone, 1935,
|
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.
Looks good 👍
It does not target project/context
but it should be okay as it is not included in any module for now.
We can merge it and iterate on the doc (want to add package level documentation too) and start building context propagation API too.
f65e403
to
a416c70
Compare
Co-authored-by: Bruce Bujon <PerfectSlayer@users.noreply.github.com>
08487fb
to
f93396d
Compare
What Does This Do
This is an initial implementation of the Evolving Context RFC.
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: APMAPI-958