-
Notifications
You must be signed in to change notification settings - Fork 142
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] Send cookie values as single string to the WAF #6164
Conversation
Snapshots difference summaryThe following differences have been observed in committed snapshots. It is meant to help the reviewer. 18 occurrences of : + _dd.appsec.fp.session: ssn--bd9bce81-d0fff5a7-,
20 occurrences of : - _dd.appsec.fp.session: ssn----,
+ _dd.appsec.fp.session: ssn--bd9bce81-d0fff5a7-,
6 occurrences of : - _dd.appsec.s.req.cookies: [{"cookie-key":[[[8]],{"len":1}]}],
+ _dd.appsec.s.req.cookies: [{"cookie-key":[8]}],
|
Datadog ReportBranch report: ✅ 0 Failed, 367978 Passed, 2080 Skipped, 16h 1m 38.12s Total Time New Flaky Tests (2)
|
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 (6164) - mean (70ms) : 68, 72
. : milestone, 70,
master - mean (70ms) : 67, 72
. : milestone, 70,
section CallTarget+Inlining+NGEN
This PR (6164) - mean (1,116ms) : 1094, 1137
. : milestone, 1116,
master - mean (1,106ms) : 1086, 1127
. : milestone, 1106,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6164) - mean (109ms) : 106, 113
. : milestone, 109,
master - mean (109ms) : 106, 112
. : milestone, 109,
section CallTarget+Inlining+NGEN
This PR (6164) - mean (766ms) : 750, 783
. : milestone, 766,
master - mean (772ms) : 755, 788
. : milestone, 772,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6164) - mean (92ms) : 90, 94
. : milestone, 92,
master - mean (92ms) : 89, 94
. : milestone, 92,
section CallTarget+Inlining+NGEN
This PR (6164) - mean (722ms) : 708, 736
. : milestone, 722,
master - mean (726ms) : 707, 746
. : milestone, 726,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6164) - mean (191ms) : 187, 194
. : milestone, 191,
master - mean (191ms) : 188, 194
. : milestone, 191,
section CallTarget+Inlining+NGEN
This PR (6164) - mean (1,207ms) : 1181, 1233
. : milestone, 1207,
master - mean (1,202ms) : 1175, 1230
. : milestone, 1202,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6164) - mean (276ms) : 271, 280
. : milestone, 276,
master - mean (276ms) : 271, 280
. : milestone, 276,
section CallTarget+Inlining+NGEN
This PR (6164) - mean (944ms) : 927, 962
. : milestone, 944,
master - mean (947ms) : 929, 964
. : milestone, 947,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6164) - mean (265ms) : 261, 269
. : milestone, 265,
master - mean (265ms) : 261, 268
. : milestone, 265,
section CallTarget+Inlining+NGEN
This PR (6164) - mean (926ms) : 906, 947
. : milestone, 926,
master - mean (932ms) : 910, 953
. : milestone, 932,
|
Benchmarks Report for appsec 🐌Benchmarks for #6164 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Iast.StringAspectsBenchmark - Slower
|
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 | 1.811 | 330,700.00 | 598,900.00 | bimodal |
Benchmark | Base Allocated | Diff Allocated | Change | Change % |
---|---|---|---|---|
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 | 255.62 KB | 314.84 KB | 59.22 KB | 23.17% |
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 | 57.26 KB | 59.44 KB | 2.18 KB | 3.81% |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StringConcatBenchmark |
net6.0 | 59μs | 714ns | 7.1μs | 0 | 0 | 0 | 43.44 KB |
master | StringConcatBenchmark |
netcoreapp3.1 | 62.4μs | 777ns | 7.73μs | 0 | 0 | 0 | 42.64 KB |
master | StringConcatBenchmark |
net472 | 37.3μs | 191ns | 856ns | 0 | 0 | 0 | 57.26 KB |
master | StringConcatAspectBenchmark |
net6.0 | 308μs | 1.7μs | 9.78μs | 0 | 0 | 0 | 254.14 KB |
master | StringConcatAspectBenchmark |
netcoreapp3.1 | 335μs | 1.73μs | 13.7μs | 0 | 0 | 0 | 255.62 KB |
master | StringConcatAspectBenchmark |
net472 | 299μs | 6.78μs | 66.1μs | 0 | 0 | 0 | 278.53 KB |
#6164 | StringConcatBenchmark |
net6.0 | 60.2μs | 706ns | 7.02μs | 0 | 0 | 0 | 43.44 KB |
#6164 | StringConcatBenchmark |
netcoreapp3.1 | 63.7μs | 1.11μs | 11μs | 0 | 0 | 0 | 42.64 KB |
#6164 | StringConcatBenchmark |
net472 | 36.8μs | 67.5ns | 243ns | 0 | 0 | 0 | 59.44 KB |
#6164 | StringConcatAspectBenchmark |
net6.0 | 306μs | 1.68μs | 9.48μs | 0 | 0 | 0 | 253.39 KB |
#6164 | StringConcatAspectBenchmark |
netcoreapp3.1 | 571μs | 7.14μs | 71μs | 0 | 0 | 0 | 314.84 KB |
#6164 | StringConcatAspectBenchmark |
net472 | 270μs | 6μs | 57.2μs | 0 | 0 | 0 | 278.53 KB |
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 (6164) (11.121M) : 0, 11120634
master (11.147M) : 0, 11146507
benchmarks/2.9.0 (11.081M) : 0, 11080577
section Automatic
This PR (6164) (7.397M) : 0, 7396654
master (7.346M) : 0, 7346161
benchmarks/2.9.0 (7.732M) : 0, 7732233
section Trace stats
master (7.696M) : 0, 7695552
section Manual
master (11.000M) : 0, 11000138
section Manual + Automatic
This PR (6164) (6.846M) : 0, 6846346
master (6.847M) : 0, 6847370
section DD_TRACE_ENABLED=0
master (10.226M) : 0, 10225834
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6164) (9.593M) : 0, 9593394
master (9.607M) : 0, 9606697
benchmarks/2.9.0 (9.798M) : 0, 9798067
section Automatic
This PR (6164) (6.412M) : 0, 6412013
master (6.391M) : 0, 6390624
section Trace stats
master (6.768M) : 0, 6767573
section Manual
master (9.365M) : 0, 9364877
section Manual + Automatic
This PR (6164) (6.167M) : 0, 6166936
master (6.038M) : 0, 6038189
section DD_TRACE_ENABLED=0
master (8.878M) : 0, 8877751
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6164) (9.866M) : 0, 9865639
master (10.185M) : 0, 10184870
benchmarks/2.9.0 (10.067M) : 0, 10067315
section Automatic
This PR (6164) (6.486M) : 0, 6486234
master (6.539M) : 0, 6539096
benchmarks/2.9.0 (7.552M) : 0, 7552193
section Trace stats
master (7.311M) : 0, 7310576
section Manual
master (9.936M) : 0, 9936096
section Manual + Automatic
This PR (6164) (5.984M) : 0, 5984040
master (6.250M) : 0, 6249990
section DD_TRACE_ENABLED=0
master (9.355M) : 0, 9355348
|
Benchmarks Report for tracer 🐌Benchmarks for #6164 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 ✔️ Fewer allocations 🎉
|
Benchmark | Base Allocated | Diff Allocated | Change | Change % |
---|---|---|---|---|
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 | 41.85 KB | 41.56 KB | -291 B | -0.70% |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | WriteAndFlushEnrichedTraces |
net6.0 | 577μs | 2.08μs | 7.52μs | 0.573 | 0 | 0 | 41.85 KB |
master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 670μs | 3.69μs | 21.2μs | 0.327 | 0 | 0 | 41.63 KB |
master | WriteAndFlushEnrichedTraces |
net472 | 875μs | 3.31μs | 12.8μs | 8.08 | 2.55 | 0.425 | 53.38 KB |
#6164 | WriteAndFlushEnrichedTraces |
net6.0 | 588μs | 2.89μs | 13.2μs | 0.592 | 0 | 0 | 41.56 KB |
#6164 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 681μs | 3.12μs | 13.6μs | 0.332 | 0 | 0 | 41.65 KB |
#6164 | WriteAndFlushEnrichedTraces |
net472 | 876μs | 4.29μs | 17.2μs | 8.75 | 2.5 | 0.417 | 53.29 KB |
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | ExecuteNonQuery |
net6.0 | 1.31μs | 1.14ns | 4.41ns | 0.0144 | 0 | 0 | 1.02 KB |
master | ExecuteNonQuery |
netcoreapp3.1 | 1.75μs | 1.34ns | 5.17ns | 0.0132 | 0 | 0 | 1.02 KB |
master | ExecuteNonQuery |
net472 | 2.07μs | 1.65ns | 6.4ns | 0.156 | 0 | 0 | 987 B |
#6164 | ExecuteNonQuery |
net6.0 | 1.28μs | 1.07ns | 4.01ns | 0.0146 | 0 | 0 | 1.02 KB |
#6164 | ExecuteNonQuery |
netcoreapp3.1 | 1.8μs | 2.22ns | 8.59ns | 0.0135 | 0 | 0 | 1.02 KB |
#6164 | ExecuteNonQuery |
net472 | 2.16μs | 3.4ns | 13.2ns | 0.156 | 0 | 0 | 987 B |
Benchmarks.Trace.ElasticsearchBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #6164
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0
1.199
1,289.36
1,075.58
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0 | 1.199 | 1,289.36 | 1,075.58 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | CallElasticsearch |
net6.0 | 1.29μs | 2.24ns | 8.38ns | 0.0133 | 0 | 0 | 976 B |
master | CallElasticsearch |
netcoreapp3.1 | 1.48μs | 3.7ns | 14.3ns | 0.0134 | 0 | 0 | 976 B |
master | CallElasticsearch |
net472 | 2.56μs | 1.81ns | 6.26ns | 0.158 | 0.00128 | 0 | 995 B |
master | CallElasticsearchAsync |
net6.0 | 1.28μs | 1.18ns | 4.56ns | 0.0128 | 0 | 0 | 952 B |
master | CallElasticsearchAsync |
netcoreapp3.1 | 1.63μs | 0.853ns | 3.3ns | 0.0139 | 0 | 0 | 1.02 KB |
master | CallElasticsearchAsync |
net472 | 2.57μs | 2.21ns | 8.28ns | 0.167 | 0 | 0 | 1.05 KB |
#6164 | CallElasticsearch |
net6.0 | 1.08μs | 0.41ns | 1.53ns | 0.014 | 0 | 0 | 976 B |
#6164 | CallElasticsearch |
netcoreapp3.1 | 1.49μs | 1ns | 3.75ns | 0.0134 | 0 | 0 | 976 B |
#6164 | CallElasticsearch |
net472 | 2.47μs | 3.5ns | 13.6ns | 0.158 | 0 | 0 | 995 B |
#6164 | CallElasticsearchAsync |
net6.0 | 1.3μs | 0.665ns | 2.49ns | 0.013 | 0 | 0 | 952 B |
#6164 | CallElasticsearchAsync |
netcoreapp3.1 | 1.62μs | 0.679ns | 2.54ns | 0.0137 | 0 | 0 | 1.02 KB |
#6164 | CallElasticsearchAsync |
net472 | 2.66μs | 3.24ns | 12.5ns | 0.167 | 0 | 0 | 1.05 KB |
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | ExecuteAsync |
net6.0 | 1.29μs | 0.992ns | 3.84ns | 0.0129 | 0 | 0 | 952 B |
master | ExecuteAsync |
netcoreapp3.1 | 1.57μs | 2.1ns | 7.87ns | 0.0126 | 0 | 0 | 952 B |
master | ExecuteAsync |
net472 | 1.72μs | 2.29ns | 8.55ns | 0.145 | 0 | 0 | 915 B |
#6164 | ExecuteAsync |
net6.0 | 1.22μs | 0.833ns | 3.12ns | 0.0135 | 0 | 0 | 952 B |
#6164 | ExecuteAsync |
netcoreapp3.1 | 1.68μs | 1.1ns | 4.1ns | 0.0128 | 0 | 0 | 952 B |
#6164 | ExecuteAsync |
net472 | 1.71μs | 1.32ns | 5.11ns | 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.19μs | 2.13ns | 8.23ns | 0.0315 | 0 | 0 | 2.22 KB |
master | SendAsync |
netcoreapp3.1 | 5.12μs | 2.73ns | 10.2ns | 0.0357 | 0 | 0 | 2.76 KB |
master | SendAsync |
net472 | 7.72μs | 5.05ns | 19.6ns | 0.499 | 0 | 0 | 3.15 KB |
#6164 | SendAsync |
net6.0 | 4.07μs | 5.36ns | 20.8ns | 0.0304 | 0 | 0 | 2.22 KB |
#6164 | SendAsync |
netcoreapp3.1 | 5.28μs | 2.32ns | 9ns | 0.0368 | 0 | 0 | 2.76 KB |
#6164 | SendAsync |
net472 | 7.92μs | 3.08ns | 11.9ns | 0.499 | 0 | 0 | 3.15 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.44μs | 1.4ns | 5.24ns | 0.0231 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
netcoreapp3.1 | 2.2μs | 1.52ns | 5.68ns | 0.0218 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
net472 | 2.51μs | 1.38ns | 5.34ns | 0.25 | 0 | 0 | 1.57 KB |
#6164 | EnrichedLog |
net6.0 | 1.5μs | 1.05ns | 3.8ns | 0.0232 | 0 | 0 | 1.64 KB |
#6164 | EnrichedLog |
netcoreapp3.1 | 2.33μs | 1.37ns | 5.12ns | 0.0222 | 0 | 0 | 1.64 KB |
#6164 | EnrichedLog |
net472 | 2.62μs | 1.3ns | 5.02ns | 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 | 116μs | 223ns | 833ns | 0.0578 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
netcoreapp3.1 | 123μs | 196ns | 761ns | 0 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
net472 | 151μs | 67.7ns | 262ns | 0.68 | 0.227 | 0 | 4.46 KB |
#6164 | EnrichedLog |
net6.0 | 116μs | 55.9ns | 202ns | 0 | 0 | 0 | 4.28 KB |
#6164 | EnrichedLog |
netcoreapp3.1 | 122μs | 174ns | 672ns | 0 | 0 | 0 | 4.28 KB |
#6164 | EnrichedLog |
net472 | 152μs | 183ns | 709ns | 0.679 | 0.226 | 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.08μs | 1.85ns | 7.15ns | 0.031 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
netcoreapp3.1 | 4.12μs | 1.69ns | 6.32ns | 0.029 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
net472 | 4.93μs | 1.36ns | 5.27ns | 0.319 | 0 | 0 | 2.02 KB |
#6164 | EnrichedLog |
net6.0 | 3.02μs | 1.13ns | 4.36ns | 0.0317 | 0 | 0 | 2.2 KB |
#6164 | EnrichedLog |
netcoreapp3.1 | 4.17μs | 2.63ns | 10.2ns | 0.0293 | 0 | 0 | 2.2 KB |
#6164 | EnrichedLog |
net472 | 4.86μs | 5.55ns | 21.5ns | 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.36μs | 0.578ns | 2.16ns | 0.0164 | 0 | 0 | 1.14 KB |
master | SendReceive |
netcoreapp3.1 | 1.73μs | 0.845ns | 3.27ns | 0.0155 | 0 | 0 | 1.14 KB |
master | SendReceive |
net472 | 2.14μs | 1.11ns | 4.16ns | 0.183 | 0.00106 | 0 | 1.16 KB |
#6164 | SendReceive |
net6.0 | 1.42μs | 1.17ns | 4.39ns | 0.0163 | 0 | 0 | 1.14 KB |
#6164 | SendReceive |
netcoreapp3.1 | 1.79μs | 0.761ns | 2.95ns | 0.0152 | 0 | 0 | 1.14 KB |
#6164 | SendReceive |
net472 | 2.05μs | 0.987ns | 3.82ns | 0.184 | 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.6μs | 1.48ns | 5.74ns | 0.0221 | 0 | 0 | 1.6 KB |
master | EnrichedLog |
netcoreapp3.1 | 3.88μs | 1.38ns | 5.33ns | 0.0212 | 0 | 0 | 1.65 KB |
master | EnrichedLog |
net472 | 4.59μs | 8.63ns | 32.3ns | 0.322 | 0 | 0 | 2.04 KB |
#6164 | EnrichedLog |
net6.0 | 2.78μs | 1.54ns | 5.95ns | 0.0222 | 0 | 0 | 1.6 KB |
#6164 | EnrichedLog |
netcoreapp3.1 | 3.92μs | 1.74ns | 6.26ns | 0.0221 | 0 | 0 | 1.65 KB |
#6164 | EnrichedLog |
net472 | 4.43μs | 6.2ns | 24ns | 0.323 | 0 | 0 | 2.04 KB |
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #6164
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0
1.217
473.23
575.84
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 | 1.217 | 473.23 | 575.84 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 400ns | 0.244ns | 0.944ns | 0.00811 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 598ns | 0.626ns | 2.34ns | 0.00779 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 705ns | 1.12ns | 4.34ns | 0.0918 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 473ns | 0.362ns | 1.4ns | 0.00975 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 700ns | 0.844ns | 3.27ns | 0.00952 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 912ns | 1.29ns | 4.98ns | 0.104 | 0 | 0 | 658 B |
#6164 | StartFinishSpan |
net6.0 | 415ns | 0.387ns | 1.5ns | 0.00799 | 0 | 0 | 576 B |
#6164 | StartFinishSpan |
netcoreapp3.1 | 623ns | 0.237ns | 0.918ns | 0.00779 | 0 | 0 | 576 B |
#6164 | StartFinishSpan |
net472 | 713ns | 0.996ns | 3.73ns | 0.0917 | 0 | 0 | 578 B |
#6164 | StartFinishScope |
net6.0 | 576ns | 0.223ns | 0.864ns | 0.0098 | 0 | 0 | 696 B |
#6164 | StartFinishScope |
netcoreapp3.1 | 674ns | 0.344ns | 1.29ns | 0.00944 | 0 | 0 | 696 B |
#6164 | StartFinishScope |
net472 | 889ns | 0.84ns | 3.03ns | 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 | 628ns | 0.275ns | 1.07ns | 0.00971 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 990ns | 0.951ns | 3.68ns | 0.00903 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.21μs | 0.739ns | 2.86ns | 0.104 | 0 | 0 | 658 B |
#6164 | RunOnMethodBegin |
net6.0 | 668ns | 0.288ns | 1.08ns | 0.00979 | 0 | 0 | 696 B |
#6164 | RunOnMethodBegin |
netcoreapp3.1 | 964ns | 0.383ns | 1.48ns | 0.00925 | 0 | 0 | 696 B |
#6164 | RunOnMethodBegin |
net472 | 1.16μs | 0.716ns | 2.77ns | 0.105 | 0 | 0 | 658 B |
internal static Dictionary<string, object> ExtractCookiesFromRequest(HttpRequest request) | ||
{ | ||
var cookies = RequestDataHelper.GetCookies(request); | ||
var cookiesDic = new Dictionary<string, object>(); |
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 could instantiate it inside clause cookies != null to avoid an allocation in some cases and have a Dictionary<string, object>?
as return type, especially that I see you check for null when the method is called
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.
Done! Thanks!
#endif | ||
if (!cookiesDic.TryGetValue(keyForDictionary, out var value)) | ||
{ | ||
cookiesDic.Add(keyForDictionary, cookie.Value ?? string.Empty); |
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.
I know it was like this before, but wondering if we really want to send cookies with a null key and/or null value to the waf 🤔
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.
Yes, I think that we should exclude cookies with null keys or values. I have updated the code.
{ | ||
if (value is string stringValue) | ||
{ | ||
cookiesDic[keyForDictionary] = new List<string> { stringValue, cookie.Value ?? string.Empty }; |
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.
same here, does it make sense to send an empty value to the list, especially if there are other actual values in the list already?
{ | ||
for (var i = 0; i < cookies.Count; i++) | ||
{ | ||
#if NETCOREAPP || NETSTANDARD |
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.
maybe we could use both SecurityCoordinator.Core
and SecurityCoordinator.Framework
to avoid these ifs?
Thanks for your reviews!!! |
Summary of changes
This PR sends the request cookies to the WAF as a single string when there is only one cookie value. Previously, we would send the value in a list. This makes the WAF to ignore these cookies when calculating the session fingerprint.
The code for header and cookies collection has been moved to securitycoordinator.cs in order to avoid duplicated code. It also helps to have a consistent behavior between frameworks. For instance, when we had no cookies, we would send an empty dictionary to the WAF in .net framework and we would send nothing for other frameworks.
As a result, the fingerprint generations have changed. A new cookie has been added to some integration tests to make sure that the hash is calculated.
Reason for change
Implementation details
Test coverage
Other details