Skip to content
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

Change the way we collect ip and header #6591

Merged
merged 6 commits into from
Feb 3, 2025

Conversation

anna-git
Copy link
Contributor

@anna-git anna-git commented Jan 24, 2025

Summary of changes

Reason for change

Customer asked and specification regarding custom ip headers and new removed header has to be updated

Implementation details

Test coverage

added 2 and improved existing unit tests

Other details

@anna-git anna-git requested review from a team as code owners January 24, 2025 13:07
@anna-git anna-git force-pushed the anna/amend-ip-collection-secscan branch from 6ea2278 to e26602c Compare January 24, 2025 13:28
@andrewlock
Copy link
Member

andrewlock commented Jan 24, 2025

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:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

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 (6591) - mean (69ms)  : 66, 73
     .   : milestone, 69,
    master - mean (69ms)  : 67, 72
     .   : milestone, 69,

    section CallTarget+Inlining+NGEN
    This PR (6591) - mean (981ms)  : 954, 1008
     .   : milestone, 981,
    master - mean (983ms)  : 953, 1012
     .   : milestone, 983,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6591) - mean (108ms)  : 106, 110
     .   : milestone, 108,
    master - mean (108ms)  : 106, 110
     .   : milestone, 108,

    section CallTarget+Inlining+NGEN
    This PR (6591) - mean (670ms)  : 652, 689
     .   : milestone, 670,
    master - mean (678ms)  : 662, 695
     .   : milestone, 678,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6591) - mean (91ms)  : 89, 93
     .   : milestone, 91,
    master - mean (91ms)  : 89, 94
     .   : milestone, 91,

    section CallTarget+Inlining+NGEN
    This PR (6591) - mean (629ms)  : 612, 646
     .   : milestone, 629,
    master - mean (632ms)  : 615, 648
     .   : milestone, 632,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6591) - mean (190ms)  : 186, 194
     .   : milestone, 190,
    master - mean (190ms)  : 185, 195
     .   : milestone, 190,

    section CallTarget+Inlining+NGEN
    This PR (6591) - mean (1,082ms)  : 1054, 1109
     .   : milestone, 1082,
    master - mean (1,083ms)  : 1060, 1106
     .   : milestone, 1083,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6591) - mean (274ms)  : 267, 281
     .   : milestone, 274,
    master - mean (276ms)  : 273, 280
     .   : milestone, 276,

    section CallTarget+Inlining+NGEN
    This PR (6591) - mean (862ms)  : 833, 891
     .   : milestone, 862,
    master - mean (868ms)  : 834, 901
     .   : milestone, 868,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6591) - mean (264ms)  : 260, 267
     .   : milestone, 264,
    master - mean (264ms)  : 259, 268
     .   : milestone, 264,

    section CallTarget+Inlining+NGEN
    This PR (6591) - mean (844ms)  : 804, 884
     .   : milestone, 844,
    master - mean (842ms)  : 809, 875
     .   : milestone, 842,

Loading

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Jan 24, 2025

Datadog Report

Branch report: anna/amend-ip-collection-secscan
Commit report: 0433fa3
Test service: dd-trace-dotnet

✅ 0 Failed, 240760 Passed, 2064 Skipped, 19h 29m 26.47s Total Time

@andrewlock
Copy link
Member

andrewlock commented Jan 24, 2025

Benchmarks Report for tracer 🐌

Benchmarks for #6591 compared to master:

  • 2 benchmarks are faster, with geometric mean 1.126
  • 1 benchmarks have more allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 8.23μs 45.9ns 315ns 0.0205 0.0123 0.0041 5.6 KB
master StartStopWithChild netcoreapp3.1 9.82μs 50.9ns 233ns 0.0146 0.00487 0 5.8 KB
master StartStopWithChild net472 16.1μs 58.7ns 219ns 1.04 0.306 0.0967 6.21 KB
#6591 StartStopWithChild net6.0 7.89μs 44.3ns 310ns 0.0157 0.00784 0 5.61 KB
#6591 StartStopWithChild netcoreapp3.1 9.95μs 55.7ns 366ns 0.0242 0.00968 0 5.81 KB
#6591 StartStopWithChild net472 16μs 56.4ns 219ns 1.06 0.328 0.109 6.21 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 521μs 668ns 2.5μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 650μs 343ns 1.33μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 856μs 490ns 1.9μs 0.428 0 0 3.3 KB
#6591 WriteAndFlushEnrichedTraces net6.0 492μs 369ns 1.33μs 0 0 0 2.7 KB
#6591 WriteAndFlushEnrichedTraces netcoreapp3.1 646μs 333ns 1.25μs 0 0 0 2.7 KB
#6591 WriteAndFlushEnrichedTraces net472 854μs 752ns 2.91μs 0.425 0 0 3.3 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 129μs 404ns 1.56μs 0.195 0 0 14.47 KB
master SendRequest netcoreapp3.1 140μs 564ns 2.18μs 0.207 0 0 17.27 KB
master SendRequest net472 0.0224ns 0.00436ns 0.0169ns 0 0 0 0 b
#6591 SendRequest net6.0 130μs 263ns 1.02μs 0.125 0 0 14.47 KB
#6591 SendRequest netcoreapp3.1 144μs 453ns 1.76μs 0.209 0 0 17.27 KB
#6591 SendRequest net472 0.00153ns 0.00128ns 0.00495ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #6591

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.41 KB 41.69 KB 276 B 0.67%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 563μs 2.68μs 11.1μs 0.566 0 0 41.41 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 660μs 2.53μs 9.45μs 0.327 0 0 41.62 KB
master WriteAndFlushEnrichedTraces net472 838μs 3.2μs 12μs 8.22 2.47 0.411 53.29 KB
#6591 WriteAndFlushEnrichedTraces net6.0 569μs 1.71μs 6.41μs 0.584 0 0 41.69 KB
#6591 WriteAndFlushEnrichedTraces netcoreapp3.1 651μs 2.54μs 9.85μs 0.327 0 0 41.7 KB
#6591 WriteAndFlushEnrichedTraces net472 835μs 4.04μs 17.1μs 8.13 2.57 0.428 53.28 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.25μs 0.848ns 3.28ns 0.0144 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.71μs 1.23ns 4.59ns 0.0137 0 0 1.02 KB
master ExecuteNonQuery net472 1.92μs 2.24ns 8.68ns 0.157 0.000961 0 987 B
#6591 ExecuteNonQuery net6.0 1.31μs 1.08ns 4.17ns 0.0145 0 0 1.02 KB
#6591 ExecuteNonQuery netcoreapp3.1 1.77μs 1.58ns 5.93ns 0.0132 0 0 1.02 KB
#6591 ExecuteNonQuery net472 2.08μs 2.68ns 10.4ns 0.156 0.00104 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.29μs 0.681ns 2.55ns 0.0136 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.5μs 0.374ns 1.35ns 0.0128 0 0 976 B
master CallElasticsearch net472 2.51μs 1.28ns 4.8ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.25μs 0.539ns 2.02ns 0.0132 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.62μs 2.58ns 9.66ns 0.0137 0 0 1.02 KB
master CallElasticsearchAsync net472 2.62μs 1.68ns 6.28ns 0.167 0 0 1.05 KB
#6591 CallElasticsearch net6.0 1.22μs 0.51ns 1.91ns 0.0134 0 0 976 B
#6591 CallElasticsearch netcoreapp3.1 1.49μs 0.907ns 3.39ns 0.0135 0 0 976 B
#6591 CallElasticsearch net472 2.5μs 0.971ns 3.63ns 0.157 0 0 995 B
#6591 CallElasticsearchAsync net6.0 1.24μs 1.26ns 4.88ns 0.0131 0 0 952 B
#6591 CallElasticsearchAsync netcoreapp3.1 1.62μs 0.659ns 2.55ns 0.0138 0 0 1.02 KB
#6591 CallElasticsearchAsync net472 2.57μs 1.91ns 7.42ns 0.166 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.31μs 0.619ns 2.4ns 0.0132 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.63μs 0.778ns 3.01ns 0.0124 0 0 952 B
master ExecuteAsync net472 1.84μs 0.383ns 1.43ns 0.145 0 0 915 B
#6591 ExecuteAsync net6.0 1.25μs 1.67ns 6.26ns 0.0133 0 0 952 B
#6591 ExecuteAsync netcoreapp3.1 1.69μs 0.48ns 1.79ns 0.0126 0 0 952 B
#6591 ExecuteAsync net472 1.9μs 0.471ns 1.82ns 0.144 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.42μs 1.51ns 5.66ns 0.0309 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.38μs 1.63ns 6.1ns 0.0376 0 0 2.85 KB
master SendAsync net472 7.38μs 1.79ns 6.95ns 0.496 0 0 3.12 KB
#6591 SendAsync net6.0 4.37μs 2.56ns 9.56ns 0.0308 0 0 2.31 KB
#6591 SendAsync netcoreapp3.1 5.3μs 2.56ns 9.91ns 0.037 0 0 2.85 KB
#6591 SendAsync net472 7.44μs 1.93ns 7.46ns 0.495 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.52μs 0.699ns 2.61ns 0.0228 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.26μs 1.61ns 6.24ns 0.0214 0 0 1.64 KB
master EnrichedLog net472 2.53μs 0.661ns 2.47ns 0.249 0 0 1.57 KB
#6591 EnrichedLog net6.0 1.49μs 0.657ns 2.46ns 0.0231 0 0 1.64 KB
#6591 EnrichedLog netcoreapp3.1 2.29μs 1.67ns 6.25ns 0.0216 0 0 1.64 KB
#6591 EnrichedLog net472 2.53μs 0.777ns 3.01ns 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 146ns 545ns 0.0582 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 120μs 166ns 644ns 0.0597 0 0 4.28 KB
master EnrichedLog net472 150μs 82.9ns 321ns 0.677 0.226 0 4.46 KB
#6591 EnrichedLog net6.0 116μs 115ns 447ns 0.058 0 0 4.28 KB
#6591 EnrichedLog netcoreapp3.1 120μs 98.3ns 355ns 0 0 0 4.28 KB
#6591 EnrichedLog net472 151μs 76.8ns 298ns 0.677 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.16μs 1.52ns 5.48ns 0.03 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.34μs 1.67ns 6.47ns 0.0283 0 0 2.2 KB
master EnrichedLog net472 5.02μs 1.31ns 5.06ns 0.319 0 0 2.02 KB
#6591 EnrichedLog net6.0 2.94μs 9.13ns 35.4ns 0.0308 0 0 2.2 KB
#6591 EnrichedLog netcoreapp3.1 4.19μs 1.29ns 5ns 0.0295 0 0 2.2 KB
#6591 EnrichedLog net472 4.96μs 1.89ns 7.31ns 0.32 0 0 2.02 KB
Benchmarks.Trace.RedisBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6591

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.RedisBenchmark.SendReceive‑net6.0 1.117 1,462.76 1,309.54

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.46μs 0.5ns 1.94ns 0.0161 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.89μs 0.609ns 2.28ns 0.0151 0 0 1.14 KB
master SendReceive net472 2.15μs 0.785ns 3.04ns 0.183 0 0 1.16 KB
#6591 SendReceive net6.0 1.31μs 0.86ns 3.33ns 0.0157 0 0 1.14 KB
#6591 SendReceive netcoreapp3.1 1.79μs 0.888ns 3.44ns 0.0151 0 0 1.14 KB
#6591 SendReceive net472 2.09μs 1.27ns 4.93ns 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.83μs 0.957ns 3.7ns 0.0213 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.94μs 3.02ns 11.7ns 0.0217 0 0 1.65 KB
master EnrichedLog net472 4.46μs 2.86ns 11.1ns 0.322 0 0 2.04 KB
#6591 EnrichedLog net6.0 2.75μs 1.2ns 4.63ns 0.022 0 0 1.6 KB
#6591 EnrichedLog netcoreapp3.1 3.98μs 1.33ns 5.15ns 0.0219 0 0 1.65 KB
#6591 EnrichedLog net472 4.61μs 3.32ns 12.9ns 0.323 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 396ns 0.4ns 1.55ns 0.0081 0 0 576 B
master StartFinishSpan netcoreapp3.1 577ns 0.721ns 2.79ns 0.00786 0 0 576 B
master StartFinishSpan net472 645ns 1.54ns 5.97ns 0.0916 0 0 578 B
master StartFinishScope net6.0 539ns 0.536ns 2.07ns 0.00986 0 0 696 B
master StartFinishScope netcoreapp3.1 688ns 1.1ns 4.25ns 0.00943 0 0 696 B
master StartFinishScope net472 799ns 2.8ns 10.8ns 0.104 0 0 658 B
#6591 StartFinishSpan net6.0 389ns 0.529ns 2.05ns 0.00808 0 0 576 B
#6591 StartFinishSpan netcoreapp3.1 607ns 0.915ns 3.54ns 0.00768 0 0 576 B
#6591 StartFinishSpan net472 585ns 1.62ns 6.27ns 0.0917 0 0 578 B
#6591 StartFinishScope net6.0 553ns 1.05ns 4.07ns 0.00971 0 0 696 B
#6591 StartFinishScope netcoreapp3.1 760ns 1.86ns 7.19ns 0.0095 0 0 696 B
#6591 StartFinishScope net472 820ns 1.72ns 6.67ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6591

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 1.136 655.68 577.28

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 655ns 0.62ns 2.4ns 0.00988 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 939ns 1.56ns 6.05ns 0.00936 0 0 696 B
master RunOnMethodBegin net472 1.05μs 3.37ns 12.6ns 0.104 0 0 658 B
#6591 RunOnMethodBegin net6.0 576ns 0.83ns 3.21ns 0.00963 0 0 696 B
#6591 RunOnMethodBegin netcoreapp3.1 923ns 1.59ns 6.16ns 0.00926 0 0 696 B
#6591 RunOnMethodBegin net472 1.05μs 1.84ns 7.15ns 0.104 0 0 658 B

@andrewlock
Copy link
Member

andrewlock commented Jan 24, 2025

Benchmarks Report for appsec 🐌

Benchmarks for #6591 compared to master:

  • 2 benchmarks are slower, with geometric mean 1.490
  • 3 benchmarks have more allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 205μs 115ns 429ns 2.63 0 0 188.69 KB
master AllCycleSimpleBody netcoreapp3.1 307μs 288ns 1.08μs 2.6 0 0 196.02 KB
master AllCycleSimpleBody net472 265μs 158ns 591ns 35.8 1.98 0 225.75 KB
master AllCycleMoreComplexBody net6.0 206μs 79ns 296ns 2.67 0 0 192.19 KB
master AllCycleMoreComplexBody netcoreapp3.1 325μs 136ns 508ns 2.71 0 0 199.43 KB
master AllCycleMoreComplexBody net472 273μs 69.2ns 250ns 36.4 2.07 0 229.27 KB
master ObjectExtractorSimpleBody net6.0 141ns 0.0765ns 0.286ns 0.00391 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 198ns 0.129ns 0.445ns 0.00371 0 0 272 B
master ObjectExtractorSimpleBody net472 164ns 0.293ns 1.14ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 2.88μs 2.15ns 7.76ns 0.0536 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 3.87μs 3.76ns 14.1ns 0.0501 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 4.3μs 1.92ns 7.43ns 0.603 0.00648 0 3.8 KB
#6591 AllCycleSimpleBody net6.0 207μs 88.8ns 332ns 2.68 0 0 188.69 KB
#6591 AllCycleSimpleBody netcoreapp3.1 304μs 68.8ns 258ns 2.58 0 0 196.02 KB
#6591 AllCycleSimpleBody net472 269μs 286ns 1.11μs 35.8 2.02 0 225.75 KB
#6591 AllCycleMoreComplexBody net6.0 208μs 107ns 399ns 2.68 0 0 192.19 KB
#6591 AllCycleMoreComplexBody netcoreapp3.1 312μs 112ns 402ns 2.8 0 0 199.43 KB
#6591 AllCycleMoreComplexBody net472 275μs 106ns 369ns 36.4 2.07 0 229.27 KB
#6591 ObjectExtractorSimpleBody net6.0 140ns 0.204ns 0.764ns 0.00395 0 0 280 B
#6591 ObjectExtractorSimpleBody netcoreapp3.1 195ns 0.133ns 0.516ns 0.00373 0 0 272 B
#6591 ObjectExtractorSimpleBody net472 165ns 0.212ns 0.822ns 0.0446 0 0 281 B
#6591 ObjectExtractorMoreComplexBody net6.0 2.85μs 2.52ns 9.77ns 0.0537 0 0 3.78 KB
#6591 ObjectExtractorMoreComplexBody netcoreapp3.1 3.8μs 1.11ns 4ns 0.0495 0 0 3.69 KB
#6591 ObjectExtractorMoreComplexBody net472 4.33μs 5.47ns 21.2ns 0.601 0.00649 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EncodeArgs net6.0 38.3μs 12.8ns 44.2ns 0.441 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 54.3μs 21.2ns 79.3ns 0.439 0 0 32.4 KB
master EncodeArgs net472 67.1μs 31.9ns 123ns 5.15 0.0668 0 32.5 KB
master EncodeLegacyArgs net6.0 71.2μs 19.3ns 72.1ns 0 0 0 2.14 KB
master EncodeLegacyArgs netcoreapp3.1 106μs 134ns 517ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 153μs 97.6ns 365ns 0.309 0 0 2.15 KB
#6591 EncodeArgs net6.0 38.5μs 15.4ns 59.6ns 0.46 0 0 32.4 KB
#6591 EncodeArgs netcoreapp3.1 54.1μs 28.1ns 109ns 0.43 0 0 32.4 KB
#6591 EncodeArgs net472 66.4μs 35.2ns 136ns 5.15 0.0665 0 32.5 KB
#6591 EncodeLegacyArgs net6.0 75μs 155ns 601ns 0.0375 0 0 2.14 KB
#6591 EncodeLegacyArgs netcoreapp3.1 103μs 96.3ns 360ns 0 0 0 2.14 KB
#6591 EncodeLegacyArgs net472 152μs 79.7ns 309ns 0.303 0 0 2.15 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 173μs 84.1ns 315ns 0 0 0 2.54 KB
master RunWafRealisticBenchmark netcoreapp3.1 188μs 214ns 828ns 0 0 0 2.49 KB
master RunWafRealisticBenchmark net472 200μs 87ns 337ns 0.401 0 0 2.55 KB
master RunWafRealisticBenchmarkWithAttack net6.0 116μs 71.8ns 278ns 0 0 0 1.57 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 123μs 68ns 245ns 0 0 0 1.55 KB
master RunWafRealisticBenchmarkWithAttack net472 132μs 82.2ns 318ns 0.198 0 0 1.58 KB
#6591 RunWafRealisticBenchmark net6.0 173μs 93.2ns 361ns 0 0 0 2.54 KB
#6591 RunWafRealisticBenchmark netcoreapp3.1 189μs 415ns 1.61μs 0 0 0 2.49 KB
#6591 RunWafRealisticBenchmark net472 201μs 84.2ns 315ns 0.405 0 0 2.55 KB
#6591 RunWafRealisticBenchmarkWithAttack net6.0 114μs 79.3ns 307ns 0 0 0 1.57 KB
#6591 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 123μs 111ns 416ns 0 0 0 1.55 KB
#6591 RunWafRealisticBenchmarkWithAttack net472 131μs 43.7ns 169ns 0.197 0 0 1.58 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #6591

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 1.887 334,150.00 630,500.00 several?
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 1.177 54,450.00 64,100.00 bimodal

More allocations ⚠️ in #6591

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 254.18 KB 326.46 KB 72.28 KB 28.44%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 254.32 KB 272.26 KB 17.94 KB 7.06%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 59.12 KB 62.46 KB 3.34 KB 5.66%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 52.2μs 237ns 1.09μs 0 0 0 43.44 KB
master StringConcatBenchmark netcoreapp3.1 54.8μs 292ns 1.49μs 0 0 0 42.64 KB
master StringConcatBenchmark net472 37.3μs 94.8ns 355ns 0 0 0 59.12 KB
master StringConcatAspectBenchmark net6.0 303μs 1.45μs 5.99μs 0 0 0 254.32 KB
master StringConcatAspectBenchmark netcoreapp3.1 339μs 1.84μs 10.8μs 0 0 0 254.18 KB
master StringConcatAspectBenchmark net472 288μs 6.53μs 63.3μs 0 0 0 278.53 KB
#6591 StringConcatBenchmark net6.0 54.9μs 251ns 938ns 0 0 0 43.44 KB
#6591 StringConcatBenchmark netcoreapp3.1 64.9μs 854ns 8.42μs 0 0 0 42.64 KB
#6591 StringConcatBenchmark net472 36.9μs 119ns 427ns 0 0 0 62.46 KB
#6591 StringConcatAspectBenchmark net6.0 304μs 5.11μs 49.8μs 0 0 0 272.26 KB
#6591 StringConcatAspectBenchmark netcoreapp3.1 640μs 3.5μs 21μs 0 0 0 326.46 KB
#6591 StringConcatAspectBenchmark net472 271μs 4.76μs 45.9μs 0 0 0 278.53 KB

Copy link
Contributor

Snapshots difference summary

The following differences have been observed in committed snapshots. It is meant to help the reviewer.
The diff is simplistic, so please check some files anyway while we improve it.

1 occurrences of :

-      _dd.appsec.s.res.headers: [{}],

@anna-git anna-git force-pushed the anna/amend-ip-collection-secscan branch from c862058 to df87607 Compare January 24, 2025 16:04
Copy link
Contributor

@NachoEchevarria NachoEchevarria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks!

@anna-git anna-git force-pushed the anna/amend-ip-collection-secscan branch 2 times, most recently from aa2ee50 to 5151fda Compare January 28, 2025 11:09
{
Log.Warning("Header {Key} couldn't be added as argument to the waf", currentKey);
if (!headersDic.ContainsKey(currentKey))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to use headersDic.TryAdd() here instead of the two separate calls to ContainsKey() and Add().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added here c9983fa
the only issue is that it adds the cumbersome test if NETCOREAPP as this isn't available otherwise :/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I forgot that TryAdd() was added in .NET Core. I was thinking of TryGetValue(). Feel free to ignore, then!

@anna-git anna-git force-pushed the anna/amend-ip-collection-secscan branch from 56a34f4 to 0433fa3 Compare January 29, 2025 12:23
@anna-git anna-git merged commit 14fc12a into master Feb 3, 2025
135 of 138 checks passed
@anna-git anna-git deleted the anna/amend-ip-collection-secscan branch February 3, 2025 16:14
@github-actions github-actions bot added this to the vNext-v3 milestone Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants