-
Notifications
You must be signed in to change notification settings - Fork 146
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
Send sampling priority to lambda extension #6719
base: master
Are you sure you want to change the base?
Send sampling priority to lambda extension #6719
Conversation
Datadog ReportAll test runs ✅ 2 Total Test Services: 0 Failed, 2 Passed Test Services
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing the following branches/commits: Execution-time benchmarks measure the whole time it takes to execute a program. And are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are shown in red. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6719) - mean (78ms) : 72, 85
. : milestone, 78,
master - mean (78ms) : 72, 84
. : milestone, 78,
section CallTarget+Inlining+NGEN
This PR (6719) - mean (1,084ms) : 1056, 1111
. : milestone, 1084,
master - mean (1,093ms) : 1058, 1128
. : milestone, 1093,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6719) - mean (116ms) : 110, 122
. : milestone, 116,
master - mean (120ms) : 113, 127
. : milestone, 120,
section CallTarget+Inlining+NGEN
This PR (6719) - mean (738ms) : 716, 759
. : milestone, 738,
master - mean (751ms) : 725, 776
. : milestone, 751,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6719) - mean (101ms) : 96, 106
. : milestone, 101,
master - mean (104ms) : 96, 112
. : milestone, 104,
section CallTarget+Inlining+NGEN
This PR (6719) - mean (687ms) : 663, 710
. : milestone, 687,
master - mean (698ms) : 675, 722
. : milestone, 698,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6719) - mean (191ms) : 187, 196
. : milestone, 191,
master - mean (191ms) : 186, 195
. : milestone, 191,
section CallTarget+Inlining+NGEN
This PR (6719) - mean (1,106ms) : 1080, 1132
. : milestone, 1106,
master - mean (1,111ms) : 1083, 1139
. : milestone, 1111,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6719) - mean (270ms) : 266, 275
. : milestone, 270,
master - mean (271ms) : 266, 276
. : milestone, 271,
section CallTarget+Inlining+NGEN
This PR (6719) - mean (868ms) : 838, 897
. : milestone, 868,
master - mean (868ms) : 840, 896
. : milestone, 868,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6719) - mean (263ms) : 258, 268
. : milestone, 263,
master - mean (262ms) : 257, 266
. : milestone, 262,
section CallTarget+Inlining+NGEN
This PR (6719) - mean (850ms) : 823, 878
. : milestone, 850,
master - mean (845ms) : 815, 876
. : milestone, 845,
|
Benchmarks Report for tracer 🐌Benchmarks for #6719 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 | 1.130 | 677.57 | 599.84 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 387ns | 0.571ns | 2.21ns | 0.00809 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 624ns | 1.26ns | 4.87ns | 0.00773 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 677ns | 1.06ns | 4.09ns | 0.0915 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 477ns | 0.556ns | 2.15ns | 0.00975 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 667ns | 0.721ns | 2.7ns | 0.00923 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 757ns | 1.46ns | 5.25ns | 0.104 | 0 | 0 | 658 B |
#6719 | StartFinishSpan |
net6.0 | 402ns | 0.392ns | 1.52ns | 0.00817 | 0 | 0 | 576 B |
#6719 | StartFinishSpan |
netcoreapp3.1 | 610ns | 1.59ns | 6.15ns | 0.00798 | 0 | 0 | 576 B |
#6719 | StartFinishSpan |
net472 | 598ns | 1.35ns | 5.22ns | 0.0916 | 0 | 0 | 578 B |
#6719 | StartFinishScope |
net6.0 | 497ns | 0.843ns | 3.26ns | 0.00966 | 0 | 0 | 696 B |
#6719 | StartFinishScope |
netcoreapp3.1 | 740ns | 1.85ns | 7.17ns | 0.00934 | 0 | 0 | 696 B |
#6719 | StartFinishScope |
net472 | 810ns | 1.68ns | 6.52ns | 0.105 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunOnMethodBegin |
net6.0 | 660ns | 1.5ns | 5.82ns | 0.00986 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 899ns | 1.47ns | 5.7ns | 0.00954 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.11μs | 2.56ns | 9.9ns | 0.104 | 0 | 0 | 658 B |
#6719 | RunOnMethodBegin |
net6.0 | 673ns | 0.883ns | 3.42ns | 0.00974 | 0 | 0 | 696 B |
#6719 | RunOnMethodBegin |
netcoreapp3.1 | 980ns | 1.74ns | 6.73ns | 0.00928 | 0 | 0 | 696 B |
#6719 | RunOnMethodBegin |
net472 | 1.08μs | 2.22ns | 8.59ns | 0.105 | 0 | 0 | 658 B |
Summary of changes
The issue here was that in Lambda, the
_rootSpan
in TraceContext.cs was never defined, soGetOrMakeSamplingDecision
always returned 1 regardless of the tracer's sampling rules (e.g. theDD_TRACE_SAMPLING_RULES
env var).This change simply updates the function to take in
span
rather than hardcoding_rootSpan
.We send this sampling decision to the Lambda extension via the
"x-datadog-sampling-priority"
header in the/lambda/end-invocation
request.Reason for change
Fix sampling rules in .NET lambdas. Before this change, 100% of traces were sampled regardless of sampling rules.
Implementation details
Test coverage
Manual:

Other details