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

[ASM] WAF error span tags #6729

Merged
merged 6 commits into from
Mar 5, 2025
Merged

[ASM] WAF error span tags #6729

merged 6 commits into from
Mar 5, 2025

Conversation

NachoEchevarria
Copy link
Contributor

@NachoEchevarria NachoEchevarria commented Feb 28, 2025

Summary of changes

This PR adds the new error span tags for ASM. It adds the error tags containing the error returned by the WAF.

These tags are defined in this RFC.

Reason for change

Implementation details

Test coverage

Other details

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Feb 28, 2025

Datadog Report

Branch report: nacho/WAFErrorSpanTags
Commit report: a1bcec7
Test service: dd-trace-dotnet

✅ 0 Failed, 250495 Passed, 2392 Skipped, 20h 7m 39.92s Total Time

@NachoEchevarria NachoEchevarria changed the title Nacho/waf error span tags ASM WAF error span tags Feb 28, 2025
@NachoEchevarria NachoEchevarria changed the title ASM WAF error span tags [ASM] WAF error span tags Feb 28, 2025
@andrewlock
Copy link
Member

andrewlock commented Feb 28, 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 (6729) - mean (69ms)  : 67, 72
     .   : milestone, 69,
    master - mean (70ms)  : 65, 74
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (6729) - mean (1,001ms)  : 978, 1024
     .   : milestone, 1001,
    master - mean (1,003ms)  : 977, 1029
     .   : milestone, 1003,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6729) - mean (103ms)  : 100, 106
     .   : milestone, 103,
    master - mean (102ms)  : 100, 105
     .   : milestone, 102,

    section CallTarget+Inlining+NGEN
    This PR (6729) - mean (687ms)  : 672, 701
     .   : milestone, 687,
    master - mean (688ms)  : 664, 711
     .   : milestone, 688,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6729) - mean (90ms)  : 88, 92
     .   : milestone, 90,
    master - mean (89ms)  : 87, 91
     .   : milestone, 89,

    section CallTarget+Inlining+NGEN
    This PR (6729) - mean (640ms)  : 623, 657
     .   : milestone, 640,
    master - mean (640ms)  : 626, 654
     .   : milestone, 640,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6729) - mean (191ms)  : 187, 195
     .   : milestone, 191,
    master - mean (191ms)  : 187, 196
     .   : milestone, 191,

    section CallTarget+Inlining+NGEN
    This PR (6729) - mean (1,107ms)  : 1080, 1134
     .   : milestone, 1107,
    master - mean (1,107ms)  : 1081, 1133
     .   : milestone, 1107,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6729) - mean (270ms)  : 266, 273
     .   : milestone, 270,
    master - mean (271ms)  : 266, 275
     .   : milestone, 271,

    section CallTarget+Inlining+NGEN
    This PR (6729) - mean (876ms)  : 837, 914
     .   : milestone, 876,
    master - mean (877ms)  : 842, 913
     .   : milestone, 877,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6729) - mean (262ms)  : 258, 265
     .   : milestone, 262,
    master - mean (262ms)  : 259, 266
     .   : milestone, 262,

    section CallTarget+Inlining+NGEN
    This PR (6729) - mean (852ms)  : 817, 886
     .   : milestone, 852,
    master - mean (855ms)  : 817, 892
     .   : milestone, 855,

Loading

@andrewlock
Copy link
Member

andrewlock commented Feb 28, 2025

Benchmarks Report for tracer 🐌

Benchmarks for #6729 compared to master:

  • 2 benchmarks are slower, with geometric mean 1.191
  • All benchmarks have the same 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.19μs 46.8ns 338ns 0.0119 0.00398 0 5.6 KB
master StartStopWithChild netcoreapp3.1 10.7μs 60.3ns 435ns 0.015 0.00499 0 5.81 KB
master StartStopWithChild net472 16.2μs 47.8ns 185ns 1.04 0.299 0.0969 6.2 KB
#6729 StartStopWithChild net6.0 8.14μs 47.1ns 380ns 0.0118 0.00393 0 5.61 KB
#6729 StartStopWithChild netcoreapp3.1 10.5μs 59.9ns 419ns 0.0159 0.00529 0 5.8 KB
#6729 StartStopWithChild net472 16.4μs 57.7ns 223ns 1.04 0.3 0.0974 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 483μs 358ns 1.39μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 644μs 635ns 2.46μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 849μs 397ns 1.54μs 0.422 0 0 3.3 KB
#6729 WriteAndFlushEnrichedTraces net6.0 490μs 116ns 420ns 0 0 0 2.7 KB
#6729 WriteAndFlushEnrichedTraces netcoreapp3.1 672μs 404ns 1.57μs 0 0 0 2.7 KB
#6729 WriteAndFlushEnrichedTraces net472 886μs 2.24μs 8.69μs 0.434 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 133μs 411ns 1.59μs 0.199 0 0 14.47 KB
master SendRequest netcoreapp3.1 151μs 212ns 794ns 0.227 0 0 17.27 KB
master SendRequest net472 0.000146ns 9.84E‑05ns 0.000368ns 0 0 0 0 b
#6729 SendRequest net6.0 131μs 464ns 1.8μs 0.192 0 0 14.47 KB
#6729 SendRequest netcoreapp3.1 147μs 257ns 994ns 0.221 0 0 17.27 KB
#6729 SendRequest net472 0.00151ns 0.000445ns 0.00173ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 549μs 2.62μs 10.5μs 0.543 0 0 41.47 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 683μs 3.34μs 13.8μs 0.324 0 0 41.84 KB
master WriteAndFlushEnrichedTraces net472 878μs 3.73μs 13.9μs 8.19 2.59 0.431 53.32 KB
#6729 WriteAndFlushEnrichedTraces net6.0 547μs 1.86μs 6.72μs 0.532 0 0 41.45 KB
#6729 WriteAndFlushEnrichedTraces netcoreapp3.1 659μs 3.44μs 17.2μs 0.334 0 0 41.67 KB
#6729 WriteAndFlushEnrichedTraces net472 854μs 3.83μs 14.8μs 8.22 2.47 0.411 53.31 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.33μs 1.28ns 4.97ns 0.014 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.82μs 1.88ns 7.28ns 0.0133 0 0 1.02 KB
master ExecuteNonQuery net472 2.12μs 1.29ns 4.81ns 0.156 0.00106 0 987 B
#6729 ExecuteNonQuery net6.0 1.28μs 2.07ns 8ns 0.0146 0 0 1.02 KB
#6729 ExecuteNonQuery netcoreapp3.1 1.83μs 1.63ns 6.33ns 0.0137 0 0 1.02 KB
#6729 ExecuteNonQuery net472 2.1μs 1.28ns 4.79ns 0.157 0.00105 0 987 B
Benchmarks.Trace.ElasticsearchBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6729

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net6.0 1.123 1,240.00 1,392.30

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.26μs 0.7ns 2.62ns 0.0139 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.55μs 3.3ns 12.3ns 0.0131 0 0 976 B
master CallElasticsearch net472 2.47μs 0.758ns 2.73ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.24μs 1.08ns 4.18ns 0.0131 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.64μs 1.06ns 3.95ns 0.0131 0 0 1.02 KB
master CallElasticsearchAsync net472 2.64μs 1ns 3.62ns 0.166 0 0 1.05 KB
#6729 CallElasticsearch net6.0 1.22μs 0.638ns 2.39ns 0.0136 0 0 976 B
#6729 CallElasticsearch netcoreapp3.1 1.56μs 1.97ns 7.11ns 0.0131 0 0 976 B
#6729 CallElasticsearch net472 2.59μs 1.67ns 6.47ns 0.157 0 0 995 B
#6729 CallElasticsearchAsync net6.0 1.39μs 0.381ns 1.48ns 0.0132 0 0 952 B
#6729 CallElasticsearchAsync netcoreapp3.1 1.65μs 0.495ns 1.85ns 0.0131 0 0 1.02 KB
#6729 CallElasticsearchAsync net472 2.53μs 1.83ns 7.09ns 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.34μs 1.58ns 5.9ns 0.0133 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.69μs 1.57ns 6.08ns 0.0128 0 0 952 B
master ExecuteAsync net472 1.85μs 0.672ns 2.6ns 0.145 0 0 915 B
#6729 ExecuteAsync net6.0 1.28μs 1.04ns 4.05ns 0.0131 0 0 952 B
#6729 ExecuteAsync netcoreapp3.1 1.56μs 0.836ns 3.24ns 0.0125 0 0 952 B
#6729 ExecuteAsync net472 1.84μs 0.299ns 1.12ns 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.36μs 1.04ns 3.75ns 0.0325 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.22μs 2.2ns 7.94ns 0.0393 0 0 2.85 KB
master SendAsync net472 7.45μs 2.36ns 9.15ns 0.492 0 0 3.12 KB
#6729 SendAsync net6.0 4.46μs 1.19ns 4.6ns 0.0311 0 0 2.31 KB
#6729 SendAsync netcoreapp3.1 5.26μs 2.36ns 9.15ns 0.0393 0 0 2.85 KB
#6729 SendAsync net472 7.52μs 2.16ns 8.37ns 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.47μs 0.781ns 3.03ns 0.0234 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.14μs 5.9ns 22.9ns 0.0223 0 0 1.64 KB
master EnrichedLog net472 2.63μs 2.01ns 7.8ns 0.25 0 0 1.57 KB
#6729 EnrichedLog net6.0 1.45μs 0.953ns 3.57ns 0.0234 0 0 1.64 KB
#6729 EnrichedLog netcoreapp3.1 2.24μs 0.973ns 3.64ns 0.0223 0 0 1.64 KB
#6729 EnrichedLog net472 2.66μs 0.651ns 2.52ns 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 114μs 158ns 612ns 0.0563 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 118μs 179ns 692ns 0 0 0 4.28 KB
master EnrichedLog net472 149μs 211ns 817ns 0.668 0.223 0 4.46 KB
#6729 EnrichedLog net6.0 114μs 98.3ns 354ns 0.0569 0 0 4.28 KB
#6729 EnrichedLog netcoreapp3.1 117μs 190ns 737ns 0.0584 0 0 4.28 KB
#6729 EnrichedLog net472 149μs 152ns 590ns 0.673 0.224 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 2.9μs 0.691ns 2.59ns 0.0318 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.16μs 3.18ns 11.5ns 0.029 0 0 2.2 KB
master EnrichedLog net472 5.01μs 1.69ns 6.54ns 0.32 0 0 2.02 KB
#6729 EnrichedLog net6.0 3.12μs 1.24ns 4.81ns 0.0311 0 0 2.2 KB
#6729 EnrichedLog netcoreapp3.1 4.18μs 3.49ns 13.5ns 0.0294 0 0 2.2 KB
#6729 EnrichedLog net472 4.98μs 1.88ns 7.27ns 0.319 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.605ns 2.34ns 0.0156 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.74μs 0.624ns 2.41ns 0.0155 0 0 1.14 KB
master SendReceive net472 2.11μs 1.34ns 5.2ns 0.183 0 0 1.16 KB
#6729 SendReceive net6.0 1.41μs 0.831ns 3.22ns 0.0165 0 0 1.14 KB
#6729 SendReceive netcoreapp3.1 1.79μs 0.921ns 3.45ns 0.0153 0 0 1.14 KB
#6729 SendReceive net472 2.03μs 1.2ns 4.66ns 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.74μs 0.565ns 2.19ns 0.022 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.9μs 2.99ns 11.6ns 0.0216 0 0 1.65 KB
master EnrichedLog net472 4.46μs 2.17ns 8.11ns 0.324 0 0 2.04 KB
#6729 EnrichedLog net6.0 2.57μs 0.97ns 3.76ns 0.0219 0 0 1.6 KB
#6729 EnrichedLog netcoreapp3.1 3.86μs 2.18ns 7.56ns 0.0213 0 0 1.65 KB
#6729 EnrichedLog net472 4.14μs 4.04ns 15.7ns 0.323 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6729

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 1.263 481.86 608.79

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 392ns 0.434ns 1.68ns 0.00798 0 0 576 B
master StartFinishSpan netcoreapp3.1 606ns 1.38ns 5.36ns 0.0079 0 0 576 B
master StartFinishSpan net472 589ns 0.892ns 3.46ns 0.0916 0 0 578 B
master StartFinishScope net6.0 481ns 0.798ns 3.09ns 0.00986 0 0 696 B
master StartFinishScope netcoreapp3.1 725ns 1.74ns 6.72ns 0.00921 0 0 696 B
master StartFinishScope net472 842ns 1.98ns 7.67ns 0.104 0 0 658 B
#6729 StartFinishSpan net6.0 408ns 0.0761ns 0.274ns 0.00806 0 0 576 B
#6729 StartFinishSpan netcoreapp3.1 569ns 0.3ns 1.16ns 0.00769 0 0 576 B
#6729 StartFinishSpan net472 582ns 0.258ns 0.965ns 0.0916 0 0 578 B
#6729 StartFinishScope net6.0 609ns 0.316ns 1.18ns 0.00972 0 0 696 B
#6729 StartFinishScope netcoreapp3.1 714ns 0.437ns 1.64ns 0.00933 0 0 696 B
#6729 StartFinishScope net472 827ns 0.25ns 0.97ns 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 615ns 1.18ns 4.58ns 0.00981 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 922ns 1.49ns 5.78ns 0.00937 0 0 696 B
master RunOnMethodBegin net472 1.06μs 2.1ns 8.12ns 0.104 0 0 658 B
#6729 RunOnMethodBegin net6.0 636ns 0.447ns 1.73ns 0.00978 0 0 696 B
#6729 RunOnMethodBegin netcoreapp3.1 929ns 0.403ns 1.56ns 0.00956 0 0 696 B
#6729 RunOnMethodBegin net472 1.04μs 0.148ns 0.553ns 0.104 0 0 658 B

@andrewlock
Copy link
Member

andrewlock commented Feb 28, 2025

Benchmarks Report for appsec 🐌

Benchmarks for #6729 compared to master:

  • 2 benchmarks are faster, with geometric mean 1.186
  • 2 benchmarks have fewer 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 - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6729

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody‑netcoreapp3.1 1.188 241.03 202.97

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 210μs 59ns 221ns 2.73 0 0 195.48 KB
master AllCycleSimpleBody netcoreapp3.1 330μs 92.8ns 347ns 2.63 0 0 203 KB
master AllCycleSimpleBody net472 287μs 79.2ns 274ns 37.1 2.18 0 233.81 KB
master AllCycleMoreComplexBody net6.0 211μs 94.3ns 353ns 2.75 0 0 198.98 KB
master AllCycleMoreComplexBody netcoreapp3.1 311μs 104ns 377ns 2.8 0 0 206.42 KB
master AllCycleMoreComplexBody net472 282μs 101ns 365ns 37.6 2.11 0 237.33 KB
master ObjectExtractorSimpleBody net6.0 141ns 0.122ns 0.456ns 0.00392 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 241ns 0.162ns 0.629ns 0.00367 0 0 272 B
master ObjectExtractorSimpleBody net472 209ns 0.103ns 0.384ns 0.0445 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 2.9μs 1.58ns 5.91ns 0.0535 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 3.8μs 1.75ns 6.54ns 0.0499 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 4.25μs 2.47ns 9.58ns 0.603 0.00649 0 3.8 KB
#6729 AllCycleSimpleBody net6.0 209μs 117ns 437ns 2.71 0 0 195.64 KB
#6729 AllCycleSimpleBody netcoreapp3.1 325μs 175ns 679ns 2.76 0 0 203.16 KB
#6729 AllCycleSimpleBody net472 277μs 477ns 1.65μs 37.2 2.09 0 233.97 KB
#6729 AllCycleMoreComplexBody net6.0 219μs 194ns 724ns 2.73 0 0 199.14 KB
#6729 AllCycleMoreComplexBody netcoreapp3.1 327μs 169ns 631ns 2.77 0 0 206.58 KB
#6729 AllCycleMoreComplexBody net472 289μs 203ns 733ns 37.6 2.16 0 237.48 KB
#6729 ObjectExtractorSimpleBody net6.0 136ns 0.0856ns 0.32ns 0.00394 0 0 280 B
#6729 ObjectExtractorSimpleBody netcoreapp3.1 203ns 0.129ns 0.481ns 0.00367 0 0 272 B
#6729 ObjectExtractorSimpleBody net472 208ns 0.148ns 0.555ns 0.0446 0 0 281 B
#6729 ObjectExtractorMoreComplexBody net6.0 2.97μs 1.26ns 4.55ns 0.0534 0 0 3.78 KB
#6729 ObjectExtractorMoreComplexBody netcoreapp3.1 3.8μs 2.97ns 10.7ns 0.051 0 0 3.69 KB
#6729 ObjectExtractorMoreComplexBody net472 4.26μs 3.22ns 12.5ns 0.603 0.00641 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.4μs 20.8ns 80.6ns 0.457 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 54μs 23.7ns 88.8ns 0.432 0 0 32.4 KB
master EncodeArgs net472 66.7μs 56.6ns 212ns 5.14 0.0668 0 32.5 KB
master EncodeLegacyArgs net6.0 74.7μs 407ns 2.34μs 0 0 0 2.14 KB
master EncodeLegacyArgs netcoreapp3.1 108μs 195ns 731ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 154μs 100ns 376ns 0.309 0 0 2.15 KB
#6729 EncodeArgs net6.0 37.4μs 20.9ns 81ns 0.447 0 0 32.4 KB
#6729 EncodeArgs netcoreapp3.1 55μs 22.7ns 81.9ns 0.437 0 0 32.4 KB
#6729 EncodeArgs net472 68.2μs 59.6ns 231ns 5.14 0.0681 0 32.5 KB
#6729 EncodeLegacyArgs net6.0 74.6μs 34.4ns 124ns 0 0 0 2.14 KB
#6729 EncodeLegacyArgs netcoreapp3.1 108μs 64.4ns 249ns 0 0 0 2.14 KB
#6729 EncodeLegacyArgs net472 155μs 318ns 1.23μs 0.306 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 176μs 87.9ns 329ns 0 0 0 2.54 KB
master RunWafRealisticBenchmark netcoreapp3.1 186μs 213ns 824ns 0 0 0 2.49 KB
master RunWafRealisticBenchmark net472 201μs 62.5ns 242ns 0.401 0 0 2.55 KB
master RunWafRealisticBenchmarkWithAttack net6.0 115μs 121ns 468ns 0 0 0 1.57 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 123μs 82.6ns 320ns 0 0 0 1.55 KB
master RunWafRealisticBenchmarkWithAttack net472 134μs 89ns 345ns 0.198 0 0 1.58 KB
#6729 RunWafRealisticBenchmark net6.0 175μs 84.3ns 326ns 0 0 0 2.54 KB
#6729 RunWafRealisticBenchmark netcoreapp3.1 185μs 79.2ns 307ns 0 0 0 2.49 KB
#6729 RunWafRealisticBenchmark net472 201μs 74.8ns 280ns 0.4 0 0 2.55 KB
#6729 RunWafRealisticBenchmarkWithAttack net6.0 117μs 56.4ns 204ns 0 0 0 1.57 KB
#6729 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 123μs 89.9ns 336ns 0 0 0 1.55 KB
#6729 RunWafRealisticBenchmarkWithAttack net472 133μs 50ns 193ns 0.199 0 0 1.58 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Faster 🎉 Fewer allocations 🎉

Faster 🎉 in #6729

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 1.184 62,100.00 52,450.00 multimodal

Fewer allocations 🎉 in #6729

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 61.93 KB 60.87 KB -1.06 KB -1.71%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 263.34 KB 255.24 KB -8.1 KB -3.08%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 61.5μs 717ns 7.17μs 0 0 0 43.44 KB
master StringConcatBenchmark netcoreapp3.1 53.4μs 271ns 1.15μs 0 0 0 42.64 KB
master StringConcatBenchmark net472 37.1μs 116ns 417ns 0 0 0 61.93 KB
master StringConcatAspectBenchmark net6.0 310μs 1.74μs 12.1μs 0 0 0 263.34 KB
master StringConcatAspectBenchmark netcoreapp3.1 345μs 1.81μs 13.4μs 0 0 0 253.16 KB
master StringConcatAspectBenchmark net472 271μs 4.5μs 42.4μs 0 0 0 278.53 KB
#6729 StringConcatBenchmark net6.0 52.8μs 282ns 1.54μs 0 0 0 43.44 KB
#6729 StringConcatBenchmark netcoreapp3.1 61.8μs 835ns 8.27μs 0 0 0 42.64 KB
#6729 StringConcatBenchmark net472 37.7μs 185ns 806ns 0 0 0 60.87 KB
#6729 StringConcatAspectBenchmark net6.0 330μs 1.82μs 10.8μs 0 0 0 255.24 KB
#6729 StringConcatAspectBenchmark netcoreapp3.1 339μs 1.93μs 13.5μs 0 0 0 252.53 KB
#6729 StringConcatAspectBenchmark net472 294μs 6.65μs 65.5μs 0 0 0 278.53 KB

@NachoEchevarria NachoEchevarria marked this pull request as ready for review February 28, 2025 12:57
@NachoEchevarria NachoEchevarria requested review from a team as code owners February 28, 2025 12:57
/// <summary>
/// The most relevant WAF error code during a request
/// </summary>
public const string WAFError = "_dd.appsec.waf.error";
Copy link
Member

@lucaspimentel lucaspimentel Mar 4, 2025

Choose a reason for hiding this comment

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

Nit picking, but to follow .NET naming conventions these should use Waf instead of WAF:

WafError
RaspWafError

like other 3-letter acronyms: Sql, Xml, etc

See also AppSecWafVersion above and AppSecWafInitRuleErrors below :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have fixed the tag names. Thanks for pointing this out!

@NachoEchevarria
Copy link
Contributor Author

Thanks for your reviews!

@NachoEchevarria NachoEchevarria merged commit d70d287 into master Mar 5, 2025
143 of 147 checks passed
@NachoEchevarria NachoEchevarria deleted the nacho/WAFErrorSpanTags branch March 5, 2025 15:50
@github-actions github-actions bot added this to the vNext-v3 milestone Mar 5, 2025
@andrewlock andrewlock added the type:enhancement Improvement to an existing feature label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:asm type:enhancement Improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants