-
Notifications
You must be signed in to change notification settings - Fork 140
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
[ASM] Fix benchmarks AppSecBodyBenchmarks: have a trace context to avoid null reference exceptions #6274
Conversation
d6b1c5e
to
56eb0dc
Compare
Datadog ReportBranch report: ❌ 6 Failed (0 Known Flaky), 369417 Passed, 2092 Skipped, 15h 19m 27.15s Total Time ❌ Failed Tests (6)
|
56eb0dc
to
a1051a1
Compare
Benchmarks Report for tracer 🐌Benchmarks for #6274 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 - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.RedisBenchmark.SendReceive‑net6.0 | 1.119 | 1,446.27 | 1,292.41 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | SendReceive |
net6.0 | 1.45μs | 0.771ns | 2.99ns | 0.0159 | 0 | 0 | 1.14 KB |
master | SendReceive |
netcoreapp3.1 | 1.78μs | 0.775ns | 3ns | 0.0151 | 0 | 0 | 1.14 KB |
master | SendReceive |
net472 | 2.17μs | 4.16ns | 16.1ns | 0.183 | 0 | 0 | 1.16 KB |
#6274 | SendReceive |
net6.0 | 1.29μs | 0.738ns | 2.86ns | 0.0162 | 0 | 0 | 1.14 KB |
#6274 | SendReceive |
netcoreapp3.1 | 1.75μs | 0.795ns | 3.08ns | 0.0158 | 0 | 0 | 1.14 KB |
#6274 | SendReceive |
net472 | 2.11μs | 1.16ns | 4.51ns | 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.8μs | 1.58ns | 5.9ns | 0.0224 | 0 | 0 | 1.6 KB |
master | EnrichedLog |
netcoreapp3.1 | 3.9μs | 2.96ns | 11.5ns | 0.0214 | 0 | 0 | 1.65 KB |
master | EnrichedLog |
net472 | 4.39μs | 2.57ns | 9.96ns | 0.323 | 0 | 0 | 2.04 KB |
#6274 | EnrichedLog |
net6.0 | 2.8μs | 0.977ns | 3.65ns | 0.021 | 0 | 0 | 1.6 KB |
#6274 | EnrichedLog |
netcoreapp3.1 | 3.92μs | 1.73ns | 6.71ns | 0.0216 | 0 | 0 | 1.65 KB |
#6274 | EnrichedLog |
net472 | 4.37μs | 3.51ns | 13.6ns | 0.323 | 0 | 0 | 2.04 KB |
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #6274
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1
1.147
639.46
557.41
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 | 1.147 | 639.46 | 557.41 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 406ns | 0.284ns | 1.1ns | 0.00803 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 640ns | 0.846ns | 3.28ns | 0.00779 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 733ns | 0.76ns | 2.63ns | 0.0916 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 492ns | 0.575ns | 2.07ns | 0.00976 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 736ns | 0.596ns | 2.31ns | 0.00911 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 873ns | 1.52ns | 5.48ns | 0.104 | 0 | 0 | 658 B |
#6274 | StartFinishSpan |
net6.0 | 406ns | 0.165ns | 0.616ns | 0.00816 | 0 | 0 | 576 B |
#6274 | StartFinishSpan |
netcoreapp3.1 | 558ns | 0.268ns | 1ns | 0.00776 | 0 | 0 | 576 B |
#6274 | StartFinishSpan |
net472 | 713ns | 0.42ns | 1.63ns | 0.0916 | 0 | 0 | 578 B |
#6274 | StartFinishScope |
net6.0 | 490ns | 0.531ns | 2.06ns | 0.00978 | 0 | 0 | 696 B |
#6274 | StartFinishScope |
netcoreapp3.1 | 743ns | 0.575ns | 2.23ns | 0.00927 | 0 | 0 | 696 B |
#6274 | StartFinishScope |
net472 | 921ns | 0.484ns | 1.88ns | 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 | 600ns | 0.444ns | 1.72ns | 0.00965 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 954ns | 1.8ns | 6.98ns | 0.00911 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.12μs | 0.714ns | 2.76ns | 0.104 | 0 | 0 | 658 B |
#6274 | RunOnMethodBegin |
net6.0 | 662ns | 1.54ns | 5.98ns | 0.00966 | 0 | 0 | 696 B |
#6274 | RunOnMethodBegin |
netcoreapp3.1 | 881ns | 1.07ns | 4.13ns | 0.00926 | 0 | 0 | 696 B |
#6274 | RunOnMethodBegin |
net472 | 1.2μs | 1.19ns | 4.6ns | 0.104 | 0 | 0 | 658 B |
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.
If it works,
Checked the logs of this run and no null ref exception 🥳 |
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 (6274) (11.293M) : 0, 11292952
master (11.082M) : 0, 11082495
benchmarks/2.9.0 (11.033M) : 0, 11032866
section Automatic
This PR (6274) (7.231M) : 0, 7231371
master (7.157M) : 0, 7156676
benchmarks/2.9.0 (7.786M) : 0, 7785853
section Trace stats
master (7.487M) : 0, 7486935
section Manual
master (11.095M) : 0, 11094549
section Manual + Automatic
This PR (6274) (6.728M) : 0, 6727801
master (6.662M) : 0, 6661600
section DD_TRACE_ENABLED=0
master (10.306M) : 0, 10305980
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6274) (9.585M) : 0, 9584642
master (9.147M) : 0, 9147171
benchmarks/2.9.0 (9.495M) : 0, 9494821
section Automatic
This PR (6274) (6.384M) : 0, 6383880
master (6.241M) : 0, 6240685
section Trace stats
master (6.456M) : 0, 6455873
section Manual
master (9.565M) : 0, 9564721
section Manual + Automatic
This PR (6274) (5.836M) : 0, 5835885
master (6.070M) : 0, 6069625
section DD_TRACE_ENABLED=0
master (8.975M) : 0, 8975239
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6274) (9.498M) : 0, 9497856
master (9.861M) : 0, 9860504
benchmarks/2.9.0 (10.020M) : 0, 10019592
section Automatic
This PR (6274) (6.379M) : 0, 6378624
master (6.281M) : 0, 6280856
benchmarks/2.9.0 (7.255M) : 0, 7255257
section Trace stats
master (6.858M) : 0, 6857519
section Manual
master (9.497M) : 0, 9496807
section Manual + Automatic
This PR (6274) (5.930M) : 0, 5930399
master (5.679M) : 0, 5679163
section DD_TRACE_ENABLED=0
master (8.903M) : 0, 8902951
|
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 (6274) - mean (69ms) : 67, 72
. : milestone, 69,
master - mean (69ms) : 67, 71
. : milestone, 69,
section CallTarget+Inlining+NGEN
This PR (6274) - mean (1,112ms) : 1094, 1131
. : milestone, 1112,
master - mean (1,107ms) : 1086, 1127
. : milestone, 1107,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6274) - mean (109ms) : 106, 111
. : milestone, 109,
master - mean (108ms) : 105, 111
. : milestone, 108,
section CallTarget+Inlining+NGEN
This PR (6274) - mean (778ms) : 763, 793
. : milestone, 778,
master - mean (778ms) : 764, 792
. : milestone, 778,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6274) - mean (92ms) : 90, 94
. : milestone, 92,
master - mean (92ms) : 90, 93
. : milestone, 92,
section CallTarget+Inlining+NGEN
This PR (6274) - mean (733ms) : 718, 749
. : milestone, 733,
master - mean (730ms) : 715, 745
. : milestone, 730,
|
Summary of changes
Not having a trace context generates a crash at
dd-trace-dotnet/tracer/src/Datadog.Trace/AppSec/ApiSecurity.cs
Line 38 in 748ade8
which in turn generates a huge amount of error logs saturating the server's disk
Reason for change
Fix benchmark creating a trace context.
https://datadoghq.atlassian.net/browse/APPSEC-55826
Implementation details
Test coverage
Other details
Would be nice to monitor error logs in benchmarks in CI