-
Notifications
You must be signed in to change notification settings - Fork 145
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
[serverless] Add lambda span to trace context #6658
base: master
Are you sure you want to change the base?
[serverless] Add lambda span to trace context #6658
Conversation
@@ -32,7 +32,7 @@ internal static Scope CreatePlaceholderScope(Tracer tracer, NameValueHeadersColl | |||
tags: null, | |||
parent: context.SpanContext, | |||
serviceName: PlaceholderServiceName, |
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.
serviceName: PlaceholderServiceName, | |
serviceName: PlaceholderServiceName, |
The PlaceholderServiceName
must be updated to what the agent expects to reject
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 (6658) - mean (69ms) : 67, 71
. : milestone, 69,
master - mean (70ms) : 67, 72
. : milestone, 70,
section CallTarget+Inlining+NGEN
This PR (6658) - mean (1,002ms) : 972, 1032
. : milestone, 1002,
master - mean (1,004ms) : 974, 1034
. : milestone, 1004,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6658) - mean (102ms) : 99, 104
. : milestone, 102,
master - mean (103ms) : 101, 106
. : milestone, 103,
section CallTarget+Inlining+NGEN
This PR (6658) - mean (675ms) : 658, 692
. : milestone, 675,
master - mean (679ms) : 659, 699
. : milestone, 679,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6658) - mean (89ms) : 87, 91
. : milestone, 89,
master - mean (90ms) : 88, 92
. : milestone, 90,
section CallTarget+Inlining+NGEN
This PR (6658) - mean (635ms) : 618, 651
. : milestone, 635,
master - mean (633ms) : 618, 649
. : milestone, 633,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6658) - mean (192ms) : 187, 197
. : milestone, 192,
master - mean (192ms) : 187, 196
. : milestone, 192,
section CallTarget+Inlining+NGEN
This PR (6658) - mean (1,109ms) : 1077, 1141
. : milestone, 1109,
master - mean (1,116ms) : 1074, 1158
. : milestone, 1116,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6658) - mean (271ms) : 267, 275
. : milestone, 271,
master - mean (271ms) : 266, 276
. : milestone, 271,
section CallTarget+Inlining+NGEN
This PR (6658) - mean (869ms) : 831, 907
. : milestone, 869,
master - mean (866ms) : 825, 906
. : milestone, 866,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6658) - mean (264ms) : 259, 268
. : milestone, 264,
master - mean (263ms) : 258, 268
. : milestone, 263,
section CallTarget+Inlining+NGEN
This PR (6658) - mean (851ms) : 813, 889
. : milestone, 851,
master - mean (848ms) : 818, 878
. : milestone, 848,
|
Benchmarks Report for tracer 🐌Benchmarks for #6658 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 - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net6.0 | 1.154 | 1,433.08 | 1,241.47 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | ExecuteNonQuery |
net6.0 | 1.43μs | 1.15ns | 4.44ns | 0.0146 | 0 | 0 | 1.02 KB |
master | ExecuteNonQuery |
netcoreapp3.1 | 1.78μs | 1.67ns | 6.45ns | 0.0133 | 0 | 0 | 1.02 KB |
master | ExecuteNonQuery |
net472 | 2.08μs | 1.54ns | 5.95ns | 0.157 | 0.00104 | 0 | 987 B |
#6658 | ExecuteNonQuery |
net6.0 | 1.25μs | 4.46ns | 20.4ns | 0.0143 | 0 | 0 | 1.02 KB |
#6658 | ExecuteNonQuery |
netcoreapp3.1 | 1.82μs | 1.58ns | 6.12ns | 0.0137 | 0 | 0 | 1.02 KB |
#6658 | ExecuteNonQuery |
net472 | 1.98μs | 2.91ns | 10.9ns | 0.156 | 0.000981 | 0 | 987 B |
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | CallElasticsearch |
net6.0 | 1.22μs | 1.95ns | 7.55ns | 0.0135 | 0 | 0 | 976 B |
master | CallElasticsearch |
netcoreapp3.1 | 1.61μs | 3.18ns | 12.3ns | 0.0127 | 0 | 0 | 976 B |
master | CallElasticsearch |
net472 | 2.53μs | 2.74ns | 10.6ns | 0.157 | 0 | 0 | 995 B |
master | CallElasticsearchAsync |
net6.0 | 1.39μs | 0.608ns | 2.36ns | 0.0133 | 0 | 0 | 952 B |
master | CallElasticsearchAsync |
netcoreapp3.1 | 1.75μs | 0.527ns | 1.97ns | 0.0139 | 0 | 0 | 1.02 KB |
master | CallElasticsearchAsync |
net472 | 2.62μs | 1.67ns | 6.47ns | 0.167 | 0 | 0 | 1.05 KB |
#6658 | CallElasticsearch |
net6.0 | 1.21μs | 0.878ns | 3.4ns | 0.0135 | 0 | 0 | 976 B |
#6658 | CallElasticsearch |
netcoreapp3.1 | 1.62μs | 0.514ns | 1.99ns | 0.0129 | 0 | 0 | 976 B |
#6658 | CallElasticsearch |
net472 | 2.56μs | 2.27ns | 8.48ns | 0.158 | 0 | 0 | 995 B |
#6658 | CallElasticsearchAsync |
net6.0 | 1.26μs | 0.626ns | 2.43ns | 0.0132 | 0 | 0 | 952 B |
#6658 | CallElasticsearchAsync |
netcoreapp3.1 | 1.73μs | 0.453ns | 1.7ns | 0.0139 | 0 | 0 | 1.02 KB |
#6658 | CallElasticsearchAsync |
net472 | 2.57μs | 1.75ns | 6.77ns | 0.167 | 0 | 0 | 1.05 KB |
Benchmarks.Trace.GraphQLBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #6658
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0
1.117
1,206.61
1,347.71
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net6.0 | 1.117 | 1,206.61 | 1,347.71 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | ExecuteAsync |
net6.0 | 1.21μs | 0.645ns | 2.5ns | 0.0134 | 0 | 0 | 952 B |
master | ExecuteAsync |
netcoreapp3.1 | 1.63μs | 0.947ns | 3.67ns | 0.013 | 0 | 0 | 952 B |
master | ExecuteAsync |
net472 | 1.84μs | 0.772ns | 2.78ns | 0.145 | 0 | 0 | 915 B |
#6658 | ExecuteAsync |
net6.0 | 1.35μs | 0.559ns | 2.09ns | 0.0136 | 0 | 0 | 952 B |
#6658 | ExecuteAsync |
netcoreapp3.1 | 1.57μs | 0.774ns | 3ns | 0.0127 | 0 | 0 | 952 B |
#6658 | ExecuteAsync |
net472 | 1.89μs | 0.92ns | 3.56ns | 0.145 | 0 | 0 | 915 B |
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | SendAsync |
net6.0 | 4.4μs | 2.09ns | 8.08ns | 0.033 | 0 | 0 | 2.31 KB |
master | SendAsync |
netcoreapp3.1 | 5.44μs | 3.52ns | 13.6ns | 0.0379 | 0 | 0 | 2.85 KB |
master | SendAsync |
net472 | 7.57μs | 18.5ns | 71.6ns | 0.495 | 0 | 0 | 3.12 KB |
#6658 | SendAsync |
net6.0 | 4.37μs | 1.99ns | 7.44ns | 0.0327 | 0 | 0 | 2.31 KB |
#6658 | SendAsync |
netcoreapp3.1 | 5.47μs | 11.5ns | 44.5ns | 0.037 | 0 | 0 | 2.85 KB |
#6658 | SendAsync |
net472 | 7.45μs | 1.51ns | 5.83ns | 0.493 | 0 | 0 | 3.12 KB |
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 1.53μs | 1.95ns | 7.55ns | 0.0228 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
netcoreapp3.1 | 2.25μs | 0.92ns | 3.56ns | 0.0225 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
net472 | 2.66μs | 1.13ns | 4.39ns | 0.25 | 0 | 0 | 1.57 KB |
#6658 | EnrichedLog |
net6.0 | 1.48μs | 0.845ns | 3.05ns | 0.0234 | 0 | 0 | 1.64 KB |
#6658 | EnrichedLog |
netcoreapp3.1 | 2.13μs | 0.756ns | 2.73ns | 0.0213 | 0 | 0 | 1.64 KB |
#6658 | EnrichedLog |
net472 | 2.48μs | 0.883ns | 3.18ns | 0.249 | 0 | 0 | 1.57 KB |
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 115μs | 309ns | 1.2μs | 0.0568 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
netcoreapp3.1 | 117μs | 204ns | 791ns | 0.0578 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
net472 | 150μs | 137ns | 529ns | 0.67 | 0.223 | 0 | 4.46 KB |
#6658 | EnrichedLog |
net6.0 | 114μs | 102ns | 395ns | 0 | 0 | 0 | 4.28 KB |
#6658 | EnrichedLog |
netcoreapp3.1 | 117μs | 163ns | 632ns | 0.0585 | 0 | 0 | 4.28 KB |
#6658 | EnrichedLog |
net472 | 149μs | 164ns | 636ns | 0.669 | 0.223 | 0 | 4.46 KB |
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 3.03μs | 2.27ns | 8.79ns | 0.0317 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
netcoreapp3.1 | 4.14μs | 3.12ns | 12.1ns | 0.0291 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
net472 | 4.84μs | 1.26ns | 4.89ns | 0.32 | 0 | 0 | 2.02 KB |
#6658 | EnrichedLog |
net6.0 | 2.96μs | 2.13ns | 8.24ns | 0.0308 | 0 | 0 | 2.2 KB |
#6658 | EnrichedLog |
netcoreapp3.1 | 4.18μs | 1.47ns | 5.68ns | 0.0292 | 0 | 0 | 2.2 KB |
#6658 | EnrichedLog |
net472 | 4.98μs | 4.64ns | 18ns | 0.32 | 0 | 0 | 2.02 KB |
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | SendReceive |
net6.0 | 1.3μs | 0.649ns | 2.34ns | 0.0157 | 0 | 0 | 1.14 KB |
master | SendReceive |
netcoreapp3.1 | 1.81μs | 0.752ns | 2.91ns | 0.0153 | 0 | 0 | 1.14 KB |
master | SendReceive |
net472 | 2.05μs | 1.18ns | 4.56ns | 0.183 | 0 | 0 | 1.16 KB |
#6658 | SendReceive |
net6.0 | 1.37μs | 0.815ns | 3.16ns | 0.0158 | 0 | 0 | 1.14 KB |
#6658 | SendReceive |
netcoreapp3.1 | 1.7μs | 0.795ns | 2.98ns | 0.0155 | 0 | 0 | 1.14 KB |
#6658 | SendReceive |
net472 | 2.07μs | 3.86ns | 14.9ns | 0.183 | 0 | 0 | 1.16 KB |
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 2.67μs | 0.988ns | 3.83ns | 0.0227 | 0 | 0 | 1.6 KB |
master | EnrichedLog |
netcoreapp3.1 | 3.9μs | 1.95ns | 7.56ns | 0.0215 | 0 | 0 | 1.65 KB |
master | EnrichedLog |
net472 | 4.4μs | 4.33ns | 16.8ns | 0.323 | 0 | 0 | 2.04 KB |
#6658 | EnrichedLog |
net6.0 | 2.67μs | 1.27ns | 4.74ns | 0.0215 | 0 | 0 | 1.6 KB |
#6658 | EnrichedLog |
netcoreapp3.1 | 3.92μs | 1.49ns | 5.78ns | 0.0215 | 0 | 0 | 1.65 KB |
#6658 | EnrichedLog |
net472 | 4.35μs | 1.76ns | 6.35ns | 0.322 | 0 | 0 | 2.04 KB |
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #6658
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1
1.129
641.54
568.17
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net472
1.118
866.81
775.12
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 | 1.129 | 641.54 | 568.17 | |
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net472 | 1.118 | 866.81 | 775.12 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 394ns | 0.572ns | 2.22ns | 0.00803 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 642ns | 1.53ns | 5.92ns | 0.00767 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 632ns | 0.781ns | 3.02ns | 0.0918 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 482ns | 0.67ns | 2.6ns | 0.00988 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 769ns | 0.957ns | 3.71ns | 0.00928 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 867ns | 1.12ns | 4.34ns | 0.104 | 0 | 0 | 658 B |
#6658 | StartFinishSpan |
net6.0 | 414ns | 0.524ns | 2.03ns | 0.00808 | 0 | 0 | 576 B |
#6658 | StartFinishSpan |
netcoreapp3.1 | 568ns | 0.967ns | 3.75ns | 0.00795 | 0 | 0 | 576 B |
#6658 | StartFinishSpan |
net472 | 577ns | 1.03ns | 4.01ns | 0.0917 | 0 | 0 | 578 B |
#6658 | StartFinishScope |
net6.0 | 492ns | 0.556ns | 2.15ns | 0.00969 | 0 | 0 | 696 B |
#6658 | StartFinishScope |
netcoreapp3.1 | 735ns | 1.16ns | 4.5ns | 0.00941 | 0 | 0 | 696 B |
#6658 | StartFinishScope |
net472 | 775ns | 0.199ns | 0.719ns | 0.104 | 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 | 640ns | 0.8ns | 3.1ns | 0.00982 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 938ns | 1.89ns | 7.31ns | 0.00943 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.15μs | 2.2ns | 8.51ns | 0.104 | 0 | 0 | 658 B |
#6658 | RunOnMethodBegin |
net6.0 | 607ns | 0.441ns | 1.71ns | 0.00979 | 0 | 0 | 696 B |
#6658 | RunOnMethodBegin |
netcoreapp3.1 | 955ns | 0.987ns | 3.82ns | 0.00945 | 0 | 0 | 696 B |
#6658 | RunOnMethodBegin |
net472 | 1.11μs | 0.107ns | 0.402ns | 0.104 | 0 | 0 | 658 B |
Throughput/Crank Report ⚡Throughput results for AspNetCoreSimpleController comparing the following branches/commits: Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red. Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards! gantt
title Throughput Linux x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6658) (11.012M) : 0, 11011857
master (11.169M) : 0, 11169359
benchmarks/2.9.0 (11.045M) : 0, 11045405
section Automatic
This PR (6658) (7.305M) : 0, 7305350
master (7.196M) : 0, 7195501
benchmarks/2.9.0 (7.885M) : 0, 7885346
section Trace stats
master (7.448M) : 0, 7448482
section Manual
master (11.019M) : 0, 11019438
section Manual + Automatic
This PR (6658) (6.744M) : 0, 6743946
master (6.613M) : 0, 6612703
section DD_TRACE_ENABLED=0
master (10.079M) : 0, 10079113
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6658) (9.805M) : 0, 9804523
master (7.929M) : 0, 7928969
benchmarks/2.9.0 (9.586M) : 0, 9586476
section Automatic
This PR (6658) (6.558M) : 0, 6558278
master (6.525M) : 0, 6524855
section Trace stats
master (6.732M) : 0, 6732077
section Manual
master (9.719M) : 0, 9718779
section Manual + Automatic
This PR (6658) (5.925M) : 0, 5925184
master (6.082M) : 0, 6081964
section DD_TRACE_ENABLED=0
master (8.794M) : 0, 8794411
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6658) (10.160M) : 0, 10160402
section Automatic
This PR (6658) (6.591M) : 0, 6590878
section Manual + Automatic
This PR (6658) (6.161M) : 0, 6161066
|
168dad8
to
eb0bf16
Compare
Summary of changes
Add the span to trace context when creating the lambda span. Therefore, the
_rootSpan
in trace context is not null, soGetOrMakeSamplingDecision()
works instead of always returning 1.Also, updates the operation+service names to
dd-tracer-serverless-span
, which allows us to send theaws.lambda
span to the lambda extension, so we can send info like error tracking, custom tags, etc (in the future).https://github.com/DataDog/datadog-lambda-extension/blob/851fd84d0298f2a9300a905f5f6ac9b73bbe8ee4/bottlecap/src/traces/trace_processor.rs#L103-L105
Reason for change
Fix sampling rules in lambda
And https://docs.google.com/document/d/1dVk9c9SJcNYhnNIcnxj4sVQtWLaeBm0hTt5YOJkhYrw/edit?tab=t.0#heading=h.pt8wcgub5epa
Implementation details
Test coverage
Manual testing showed that sampling rules now work in Lambda
Other details