Add ParentBasedAlwaysOnSampler as default sampler for OTLP trace export mode#10915
Conversation
…r for otlp mode, instead of priority sampling or traces rate based sampler. plus tests
|
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
dd-trace-core/src/test/groovy/datadog/trace/common/sampling/SamplerTest.groovy
Outdated
Show resolved
Hide resolved
| log.error("Invalid sampler configuration. Using AllSampler", e); | ||
| sampler = new AllSampler(); | ||
| } | ||
| // TODO: if OTLP trace export enabled, select ParentBasedAlwaysOnSampler here |
There was a problem hiding this comment.
You can use config.isTraceOtlpExporterEnabled() here
...ace-core/src/test/groovy/datadog/trace/common/sampling/ParentBasedAlwaysOnSamplerTest.groovy
Outdated
Show resolved
Hide resolved
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 66 metrics, 5 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.61.0-SNAPSHOT~4ec9b55c91, baseline=1.61.0-SNAPSHOT~68aa369a4f
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.054 s) : 0, 1053991
Total [baseline] (11.092 s) : 0, 11091741
Agent [candidate] (1.062 s) : 0, 1061922
Total [candidate] (11.199 s) : 0, 11199470
section appsec
Agent [baseline] (1.254 s) : 0, 1253624
Total [baseline] (11.197 s) : 0, 11196525
Agent [candidate] (1.246 s) : 0, 1245827
Total [candidate] (11.171 s) : 0, 11171484
section iast
Agent [baseline] (1.226 s) : 0, 1226264
Total [baseline] (11.305 s) : 0, 11304588
Agent [candidate] (1.226 s) : 0, 1225852
Total [candidate] (7.965 s) : 0, 7965377
section profiling
Agent [baseline] (1.19 s) : 0, 1190100
Total [baseline] (11.042 s) : 0, 11041818
Agent [candidate] (1.181 s) : 0, 1180901
Total [candidate] (11.051 s) : 0, 11051428
gantt
title petclinic - break down per module: candidate=1.61.0-SNAPSHOT~4ec9b55c91, baseline=1.61.0-SNAPSHOT~68aa369a4f
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.189 ms) : 0, 1189
crashtracking [candidate] (1.195 ms) : 0, 1195
BytebuddyAgent [baseline] (627.372 ms) : 0, 627372
BytebuddyAgent [candidate] (631.113 ms) : 0, 631113
AgentMeter [baseline] (29.207 ms) : 0, 29207
AgentMeter [candidate] (29.618 ms) : 0, 29618
GlobalTracer [baseline] (256.382 ms) : 0, 256382
GlobalTracer [candidate] (258.553 ms) : 0, 258553
AppSec [baseline] (31.597 ms) : 0, 31597
AppSec [candidate] (32.191 ms) : 0, 32191
Debugger [baseline] (60.22 ms) : 0, 60220
Debugger [candidate] (61.019 ms) : 0, 61019
Remote Config [baseline] (589.959 µs) : 0, 590
Remote Config [candidate] (591.482 µs) : 0, 591
Telemetry [baseline] (8.038 ms) : 0, 8038
Telemetry [candidate] (8.113 ms) : 0, 8113
Flare Poller [baseline] (3.506 ms) : 0, 3506
Flare Poller [candidate] (3.543 ms) : 0, 3543
section appsec
crashtracking [baseline] (1.209 ms) : 0, 1209
crashtracking [candidate] (1.195 ms) : 0, 1195
BytebuddyAgent [baseline] (662.809 ms) : 0, 662809
BytebuddyAgent [candidate] (658.528 ms) : 0, 658528
AgentMeter [baseline] (12.2 ms) : 0, 12200
AgentMeter [candidate] (12.127 ms) : 0, 12127
GlobalTracer [baseline] (259.145 ms) : 0, 259145
GlobalTracer [candidate] (257.626 ms) : 0, 257626
IAST [baseline] (24.362 ms) : 0, 24362
IAST [candidate] (24.156 ms) : 0, 24156
AppSec [baseline] (178.325 ms) : 0, 178325
AppSec [candidate] (177.464 ms) : 0, 177464
Debugger [baseline] (66.485 ms) : 0, 66485
Debugger [candidate] (65.922 ms) : 0, 65922
Remote Config [baseline] (636.276 µs) : 0, 636
Remote Config [candidate] (625.34 µs) : 0, 625
Telemetry [baseline] (8.424 ms) : 0, 8424
Telemetry [candidate] (8.368 ms) : 0, 8368
Flare Poller [baseline] (3.622 ms) : 0, 3622
Flare Poller [candidate] (3.586 ms) : 0, 3586
section iast
crashtracking [baseline] (1.193 ms) : 0, 1193
crashtracking [candidate] (1.196 ms) : 0, 1196
BytebuddyAgent [baseline] (795.059 ms) : 0, 795059
BytebuddyAgent [candidate] (794.798 ms) : 0, 794798
AgentMeter [baseline] (11.379 ms) : 0, 11379
AgentMeter [candidate] (11.36 ms) : 0, 11360
GlobalTracer [baseline] (246.714 ms) : 0, 246714
GlobalTracer [candidate] (247.006 ms) : 0, 247006
IAST [baseline] (25.323 ms) : 0, 25323
IAST [candidate] (25.425 ms) : 0, 25425
AppSec [baseline] (26.5 ms) : 0, 26500
AppSec [candidate] (26.68 ms) : 0, 26680
Debugger [baseline] (70.935 ms) : 0, 70935
Debugger [candidate] (70.208 ms) : 0, 70208
Remote Config [baseline] (530.864 µs) : 0, 531
Remote Config [candidate] (515.208 µs) : 0, 515
Telemetry [baseline] (9.184 ms) : 0, 9184
Telemetry [candidate] (9.214 ms) : 0, 9214
Flare Poller [baseline] (3.379 ms) : 0, 3379
Flare Poller [candidate] (3.391 ms) : 0, 3391
section profiling
crashtracking [baseline] (1.189 ms) : 0, 1189
crashtracking [candidate] (1.174 ms) : 0, 1174
BytebuddyAgent [baseline] (688.404 ms) : 0, 688404
BytebuddyAgent [candidate] (681.527 ms) : 0, 681527
AgentMeter [baseline] (9.03 ms) : 0, 9030
AgentMeter [candidate] (9.02 ms) : 0, 9020
GlobalTracer [baseline] (216.113 ms) : 0, 216113
GlobalTracer [candidate] (215.181 ms) : 0, 215181
AppSec [baseline] (32.316 ms) : 0, 32316
AppSec [candidate] (32.134 ms) : 0, 32134
Debugger [baseline] (65.665 ms) : 0, 65665
Debugger [candidate] (65.749 ms) : 0, 65749
Remote Config [baseline] (561.799 µs) : 0, 562
Remote Config [candidate] (562.672 µs) : 0, 563
Telemetry [baseline] (7.742 ms) : 0, 7742
Telemetry [candidate] (7.708 ms) : 0, 7708
Flare Poller [baseline] (3.505 ms) : 0, 3505
Flare Poller [candidate] (3.436 ms) : 0, 3436
ProfilingAgent [baseline] (94.221 ms) : 0, 94221
ProfilingAgent [candidate] (93.582 ms) : 0, 93582
Profiling [baseline] (94.778 ms) : 0, 94778
Profiling [candidate] (94.14 ms) : 0, 94140
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.61.0-SNAPSHOT~4ec9b55c91, baseline=1.61.0-SNAPSHOT~68aa369a4f
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.063 s) : 0, 1062951
Total [baseline] (8.882 s) : 0, 8881903
Agent [candidate] (1.068 s) : 0, 1067996
Total [candidate] (8.837 s) : 0, 8837115
section iast
Agent [baseline] (1.225 s) : 0, 1225338
Total [baseline] (9.577 s) : 0, 9576748
Agent [candidate] (1.237 s) : 0, 1237039
Total [candidate] (9.57 s) : 0, 9569835
gantt
title insecure-bank - break down per module: candidate=1.61.0-SNAPSHOT~4ec9b55c91, baseline=1.61.0-SNAPSHOT~68aa369a4f
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.211 ms) : 0, 1211
crashtracking [candidate] (1.213 ms) : 0, 1213
BytebuddyAgent [baseline] (633.007 ms) : 0, 633007
BytebuddyAgent [candidate] (638.002 ms) : 0, 638002
AgentMeter [baseline] (29.593 ms) : 0, 29593
AgentMeter [candidate] (29.62 ms) : 0, 29620
GlobalTracer [baseline] (258.13 ms) : 0, 258130
GlobalTracer [candidate] (258.701 ms) : 0, 258701
AppSec [baseline] (31.968 ms) : 0, 31968
AppSec [candidate] (32.03 ms) : 0, 32030
Debugger [baseline] (60.01 ms) : 0, 60010
Debugger [candidate] (59.984 ms) : 0, 59984
Remote Config [baseline] (590.563 µs) : 0, 591
Remote Config [candidate] (588.285 µs) : 0, 588
Telemetry [baseline] (8.086 ms) : 0, 8086
Telemetry [candidate] (8.063 ms) : 0, 8063
Flare Poller [baseline] (4.306 ms) : 0, 4306
Flare Poller [candidate] (3.569 ms) : 0, 3569
section iast
crashtracking [baseline] (1.188 ms) : 0, 1188
crashtracking [candidate] (1.243 ms) : 0, 1243
BytebuddyAgent [baseline] (794.056 ms) : 0, 794056
BytebuddyAgent [candidate] (803.123 ms) : 0, 803123
AgentMeter [baseline] (11.415 ms) : 0, 11415
AgentMeter [candidate] (11.677 ms) : 0, 11677
GlobalTracer [baseline] (247.152 ms) : 0, 247152
GlobalTracer [candidate] (248.671 ms) : 0, 248671
IAST [baseline] (25.351 ms) : 0, 25351
IAST [candidate] (25.644 ms) : 0, 25644
AppSec [baseline] (26.533 ms) : 0, 26533
AppSec [candidate] (26.856 ms) : 0, 26856
Debugger [baseline] (67.735 ms) : 0, 67735
Debugger [candidate] (70.456 ms) : 0, 70456
Remote Config [baseline] (529.977 µs) : 0, 530
Remote Config [candidate] (544.286 µs) : 0, 544
Telemetry [baseline] (11.304 ms) : 0, 11304
Telemetry [candidate] (9.215 ms) : 0, 9215
Flare Poller [baseline] (4.013 ms) : 0, 4013
Flare Poller [candidate] (3.4 ms) : 0, 3400
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 1 performance regressions! Performance is the same for 20 metrics, 15 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.61.0-SNAPSHOT~4ec9b55c91, baseline=1.61.0-SNAPSHOT~68aa369a4f
dateFormat X
axisFormat %s
section baseline
no_agent (18.911 ms) : 18716, 19106
. : milestone, 18911,
appsec (18.628 ms) : 18444, 18813
. : milestone, 18628,
code_origins (18.235 ms) : 18056, 18415
. : milestone, 18235,
iast (17.72 ms) : 17547, 17894
. : milestone, 17720,
profiling (18.498 ms) : 18311, 18685
. : milestone, 18498,
tracing (18.275 ms) : 18095, 18455
. : milestone, 18275,
section candidate
no_agent (18.994 ms) : 18800, 19188
. : milestone, 18994,
appsec (18.321 ms) : 18139, 18503
. : milestone, 18321,
code_origins (17.679 ms) : 17503, 17855
. : milestone, 17679,
iast (17.901 ms) : 17723, 18079
. : milestone, 17901,
profiling (18.907 ms) : 18718, 19097
. : milestone, 18907,
tracing (17.852 ms) : 17675, 18029
. : milestone, 17852,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.61.0-SNAPSHOT~4ec9b55c91, baseline=1.61.0-SNAPSHOT~68aa369a4f
dateFormat X
axisFormat %s
section baseline
no_agent (1.166 ms) : 1155, 1177
. : milestone, 1166,
iast (3.232 ms) : 3190, 3275
. : milestone, 3232,
iast_FULL (5.836 ms) : 5777, 5894
. : milestone, 5836,
iast_GLOBAL (3.547 ms) : 3482, 3611
. : milestone, 3547,
profiling (2.016 ms) : 1998, 2033
. : milestone, 2016,
tracing (1.798 ms) : 1783, 1813
. : milestone, 1798,
section candidate
no_agent (1.192 ms) : 1180, 1204
. : milestone, 1192,
iast (3.241 ms) : 3199, 3283
. : milestone, 3241,
iast_FULL (5.868 ms) : 5809, 5927
. : milestone, 5868,
iast_GLOBAL (3.435 ms) : 3390, 3481
. : milestone, 3435,
profiling (2.3 ms) : 2279, 2320
. : milestone, 2300,
tracing (1.82 ms) : 1804, 1836
. : milestone, 1820,
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.61.0-SNAPSHOT~4ec9b55c91, baseline=1.61.0-SNAPSHOT~68aa369a4f
dateFormat X
axisFormat %s
section baseline
no_agent (1.468 ms) : 1457, 1480
. : milestone, 1468,
appsec (3.824 ms) : 3604, 4045
. : milestone, 3824,
iast (2.251 ms) : 2182, 2320
. : milestone, 2251,
iast_GLOBAL (2.296 ms) : 2227, 2366
. : milestone, 2296,
profiling (2.075 ms) : 2020, 2130
. : milestone, 2075,
tracing (2.061 ms) : 2008, 2115
. : milestone, 2061,
section candidate
no_agent (1.47 ms) : 1459, 1481
. : milestone, 1470,
appsec (3.804 ms) : 3583, 4025
. : milestone, 3804,
iast (2.247 ms) : 2178, 2315
. : milestone, 2247,
iast_GLOBAL (2.295 ms) : 2225, 2364
. : milestone, 2295,
profiling (2.113 ms) : 2057, 2170
. : milestone, 2113,
tracing (2.054 ms) : 2001, 2108
. : milestone, 2054,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.61.0-SNAPSHOT~4ec9b55c91, baseline=1.61.0-SNAPSHOT~68aa369a4f
dateFormat X
axisFormat %s
section baseline
no_agent (15.019 s) : 15019000, 15019000
. : milestone, 15019000,
appsec (15.052 s) : 15052000, 15052000
. : milestone, 15052000,
iast (18.004 s) : 18004000, 18004000
. : milestone, 18004000,
iast_GLOBAL (18.035 s) : 18035000, 18035000
. : milestone, 18035000,
profiling (14.924 s) : 14924000, 14924000
. : milestone, 14924000,
tracing (14.882 s) : 14882000, 14882000
. : milestone, 14882000,
section candidate
no_agent (15.608 s) : 15608000, 15608000
. : milestone, 15608000,
appsec (14.526 s) : 14526000, 14526000
. : milestone, 14526000,
iast (18.646 s) : 18646000, 18646000
. : milestone, 18646000,
iast_GLOBAL (17.895 s) : 17895000, 17895000
. : milestone, 17895000,
profiling (14.863 s) : 14863000, 14863000
. : milestone, 14863000,
tracing (14.906 s) : 14906000, 14906000
. : milestone, 14906000,
|
| static Stream<Arguments> childSpanInheritsSamplingDecisionFromRemoteParentArguments() { | ||
| return Stream.of( | ||
| Arguments.arguments("sampler keep", SAMPLER_KEEP), | ||
| Arguments.arguments("sampler drop", SAMPLER_DROP), | ||
| Arguments.arguments("user keep", USER_KEEP), | ||
| Arguments.arguments("user drop", USER_DROP)); | ||
| } |
There was a problem hiding this comment.
Nice rework to JUnit!
Let's use @TableTest instead of @MethodSource, you can use as example
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
What Does This Do
Adds a
ParentBasedAlwaysOnSamplerthat will be used as the default sampler when OTLP trace export is enabled and no user-defined sampling rules are configured. In this mode, child spans inherit sampling decision from their parent, but new root spans are always kept.This PR is just one part of the OTLP Export Implementation -- Phase 1.
Motivation
When exporting traces via OTLP, there is no Datadog Agent to back-propagate sampling rates. This PR adds the OpenTelemetry-standard
parentbased_always_on(ref) fallback sampler, ensuring traces are sampled at 100% by default while still respecting user-configured rules.Additional Notes
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]
Note: Once your PR is ready to merge, add it to the merge queue by commenting
/merge./merge -ccancels the queue request./merge -f --reason "reason"skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.