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] Error metric for unknown operator errors #6465

Merged
merged 6 commits into from
Dec 23, 2024

Conversation

NachoEchevarria
Copy link
Contributor

@NachoEchevarria NachoEchevarria commented Dec 19, 2024

When we experience an "unknown matcher operator" error in the WAF, we should not increase the _dd.appsec.event_rules.error_count metric in the span.

Summary of changes

Reason for change

Implementation details

Test coverage

Other details

@andrewlock
Copy link
Member

andrewlock commented Dec 19, 2024

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 (6465) - mean (68ms)  : 66, 71
     .   : milestone, 68,
    master - mean (69ms)  : 65, 72
     .   : milestone, 69,

    section CallTarget+Inlining+NGEN
    This PR (6465) - mean (976ms)  : 946, 1007
     .   : milestone, 976,
    master - mean (977ms)  : 950, 1003
     .   : milestone, 977,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6465) - mean (107ms)  : 105, 109
     .   : milestone, 107,
    master - mean (108ms)  : 104, 112
     .   : milestone, 108,

    section CallTarget+Inlining+NGEN
    This PR (6465) - mean (676ms)  : 663, 688
     .   : milestone, 676,
    master - mean (679ms)  : 665, 692
     .   : milestone, 679,

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

    section CallTarget+Inlining+NGEN
    This PR (6465) - mean (631ms)  : 612, 650
     .   : milestone, 631,
    master - mean (636ms)  : 620, 652
     .   : milestone, 636,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6465) - mean (194ms)  : 189, 198
     .   : milestone, 194,
    master - mean (194ms)  : 189, 198
     .   : milestone, 194,

    section CallTarget+Inlining+NGEN
    This PR (6465) - mean (1,101ms)  : 1074, 1128
     .   : milestone, 1101,
    master - mean (1,097ms)  : 1072, 1122
     .   : milestone, 1097,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6465) - mean (277ms)  : 274, 281
     .   : milestone, 277,
    master - mean (278ms)  : 274, 282
     .   : milestone, 278,

    section CallTarget+Inlining+NGEN
    This PR (6465) - mean (870ms)  : 834, 907
     .   : milestone, 870,
    master - mean (871ms)  : 842, 901
     .   : milestone, 871,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6465) - mean (266ms)  : 263, 270
     .   : milestone, 266,
    master - mean (266ms)  : 263, 270
     .   : milestone, 266,

    section CallTarget+Inlining+NGEN
    This PR (6465) - mean (854ms)  : 821, 886
     .   : milestone, 854,
    master - mean (850ms)  : 817, 884
     .   : milestone, 850,

Loading

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Dec 19, 2024

Datadog Report

Branch report: nacho/InitRulesErrorFix
Commit report: dd84c7e
Test service: dd-trace-dotnet

✅ 0 Failed, 452477 Passed, 2810 Skipped, 20h 32m 20.13s Total Time
❄️ 1 New Flaky

New Flaky Tests (1)

  • HttpClient_SubmitsTraces - Datadog.Trace.ClrProfiler.IntegrationTests.HttpMessageHandlerTests

@NachoEchevarria NachoEchevarria changed the title Add only error count metric when there are not only unknown operator … [ASM] Error metric for unknown operator errors Dec 19, 2024
@andrewlock
Copy link
Member

andrewlock commented Dec 20, 2024

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 (6465) (11.006M)   : 0, 11006170
    master (11.166M)   : 0, 11165619
    benchmarks/2.9.0 (11.033M)   : 0, 11032866

    section Automatic
    This PR (6465) (7.169M)   : 0, 7168911
    master (7.232M)   : 0, 7232435
    benchmarks/2.9.0 (7.786M)   : 0, 7785853

    section Trace stats
    master (7.555M)   : 0, 7555239

    section Manual
    master (11.218M)   : 0, 11218357

    section Manual + Automatic
    This PR (6465) (6.615M)   : 0, 6614739
    master (6.695M)   : 0, 6694720

    section DD_TRACE_ENABLED=0
    master (10.195M)   : 0, 10194994

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6465) (9.626M)   : 0, 9625805
    master (9.350M)   : 0, 9350086
    benchmarks/2.9.0 (9.495M)   : 0, 9494821

    section Automatic
    This PR (6465) (6.484M)   : 0, 6484247
    master (6.223M)   : 0, 6222880

    section Trace stats
    master (6.644M)   : 0, 6644302

    section Manual
    master (9.490M)   : 0, 9490052

    section Manual + Automatic
    This PR (6465) (5.985M)   : 0, 5984629
    master (5.826M)   : 0, 5826117

    section DD_TRACE_ENABLED=0
    master (8.806M)   : 0, 8806093

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6465) (10.022M)   : 0, 10021828
    master (10.038M)   : 0, 10038108
    benchmarks/2.9.0 (10.020M)   : 0, 10019592

    section Automatic
    This PR (6465) (6.500M)   : 0, 6499711
    master (6.759M)   : 0, 6759031
    benchmarks/2.9.0 (7.255M)   : 0, 7255257

    section Trace stats
    master (7.327M)   : 0, 7327150

    section Manual
    master (10.148M)   : 0, 10147695

    section Manual + Automatic
    This PR (6465) (6.090M)   : 0, 6090342
    master (6.270M)   : 0, 6270298

    section DD_TRACE_ENABLED=0
    master (9.572M)   : 0, 9571995

Loading

@NachoEchevarria NachoEchevarria marked this pull request as ready for review December 20, 2024 09:05
@NachoEchevarria NachoEchevarria requested a review from a team as a code owner December 20, 2024 09:05
@andrewlock
Copy link
Member

Benchmarks Report for tracer 🐌

Benchmarks for #6465 compared to master:

  • All benchmarks have the same speed
  • 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 7.89μs 42.1ns 231ns 0.0191 0.00762 0 5.61 KB
master StartStopWithChild netcoreapp3.1 10.3μs 56.9ns 346ns 0.02 0.00998 0 5.8 KB
master StartStopWithChild net472 16.4μs 46.6ns 174ns 1.04 0.326 0.0979 6.21 KB
#6465 StartStopWithChild net6.0 7.97μs 45.3ns 333ns 0.0126 0.00419 0 5.61 KB
#6465 StartStopWithChild netcoreapp3.1 9.97μs 53.2ns 286ns 0.021 0.0105 0 5.8 KB
#6465 StartStopWithChild net472 16.3μs 26.5ns 99.3ns 1.06 0.342 0.0897 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 505μs 187ns 674ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 665μs 191ns 713ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 851μs 601ns 2.25μs 0.425 0 0 3.3 KB
#6465 WriteAndFlushEnrichedTraces net6.0 475μs 283ns 1.1μs 0 0 0 2.7 KB
#6465 WriteAndFlushEnrichedTraces netcoreapp3.1 658μs 431ns 1.67μs 0 0 0 2.7 KB
#6465 WriteAndFlushEnrichedTraces net472 846μs 623ns 2.24μs 0.422 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 159μs 1.17μs 11.7μs 0.155 0 0 14.47 KB
master SendRequest netcoreapp3.1 171μs 989ns 8.85μs 0.16 0 0 17.27 KB
master SendRequest net472 0.00147ns 0.000331ns 0.00119ns 0 0 0 0 b
#6465 SendRequest net6.0 164μs 1.34μs 13.2μs 0.163 0 0 14.47 KB
#6465 SendRequest netcoreapp3.1 186μs 1.36μs 13.5μs 0.169 0 0 17.29 KB
#6465 SendRequest net472 9.99E‑05ns 7.73E‑05ns 0.000289ns 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 574μs 3.16μs 19.7μs 0.571 0 0 41.6 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 667μs 3.5μs 18.2μs 0.319 0 0 41.66 KB
master WriteAndFlushEnrichedTraces net472 874μs 3.72μs 14.4μs 8.19 2.59 0.431 53.28 KB
#6465 WriteAndFlushEnrichedTraces net6.0 545μs 2.23μs 8.05μs 0.543 0 0 41.48 KB
#6465 WriteAndFlushEnrichedTraces netcoreapp3.1 691μs 3.9μs 26.8μs 0.351 0 0 41.79 KB
#6465 WriteAndFlushEnrichedTraces net472 836μs 3.91μs 16.1μs 8.25 2.6 0.434 53.3 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.28μs 1.12ns 4.19ns 0.0142 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.86μs 1.63ns 6.3ns 0.0138 0 0 1.02 KB
master ExecuteNonQuery net472 2.11μs 1.82ns 7.04ns 0.156 0.00105 0 987 B
#6465 ExecuteNonQuery net6.0 1.25μs 1.13ns 4.38ns 0.0143 0 0 1.02 KB
#6465 ExecuteNonQuery netcoreapp3.1 1.75μs 1.44ns 5.59ns 0.0133 0 0 1.02 KB
#6465 ExecuteNonQuery net472 2.11μs 4.26ns 16.5ns 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.25μs 0.547ns 2.05ns 0.0138 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.61μs 1.32ns 5.13ns 0.0128 0 0 976 B
master CallElasticsearch net472 2.49μs 2.37ns 9.17ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.35μs 0.4ns 1.44ns 0.013 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.76μs 1.28ns 4.95ns 0.014 0 0 1.02 KB
master CallElasticsearchAsync net472 2.68μs 0.672ns 2.42ns 0.166 0 0 1.05 KB
#6465 CallElasticsearch net6.0 1.19μs 0.713ns 2.67ns 0.0139 0 0 976 B
#6465 CallElasticsearch netcoreapp3.1 1.53μs 0.92ns 3.56ns 0.013 0 0 976 B
#6465 CallElasticsearch net472 2.56μs 1.2ns 4.64ns 0.158 0 0 995 B
#6465 CallElasticsearchAsync net6.0 1.26μs 0.762ns 2.95ns 0.0133 0 0 952 B
#6465 CallElasticsearchAsync netcoreapp3.1 1.75μs 0.626ns 2.34ns 0.0131 0 0 1.02 KB
#6465 CallElasticsearchAsync net472 2.6μs 1.83ns 7.11ns 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.34μs 0.61ns 2.28ns 0.0139 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.59μs 0.735ns 2.75ns 0.0129 0 0 952 B
master ExecuteAsync net472 1.84μs 0.58ns 2.17ns 0.145 0 0 915 B
#6465 ExecuteAsync net6.0 1.24μs 0.509ns 1.9ns 0.013 0 0 952 B
#6465 ExecuteAsync netcoreapp3.1 1.68μs 1.03ns 3.99ns 0.0125 0 0 952 B
#6465 ExecuteAsync net472 1.74μs 0.298ns 1.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.46μs 0.961ns 3.72ns 0.0313 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.12μs 1.94ns 6.98ns 0.0361 0 0 2.85 KB
master SendAsync net472 7.37μs 1.27ns 4.57ns 0.494 0 0 3.12 KB
#6465 SendAsync net6.0 4.37μs 1.62ns 6.28ns 0.0328 0 0 2.31 KB
#6465 SendAsync netcoreapp3.1 5.3μs 1.63ns 5.86ns 0.0379 0 0 2.85 KB
#6465 SendAsync net472 7.41μs 6.23ns 23.3ns 0.494 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.46μs 0.521ns 1.88ns 0.0228 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.25μs 9.33ns 36.1ns 0.0218 0 0 1.64 KB
master EnrichedLog net472 2.67μs 1.31ns 4.9ns 0.25 0 0 1.57 KB
#6465 EnrichedLog net6.0 1.44μs 0.798ns 2.99ns 0.0232 0 0 1.64 KB
#6465 EnrichedLog netcoreapp3.1 2.28μs 1.08ns 4.02ns 0.0227 0 0 1.64 KB
#6465 EnrichedLog net472 2.7μs 1.45ns 5.44ns 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 119μs 165ns 616ns 0.0598 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 122μs 179ns 691ns 0 0 0 4.28 KB
master EnrichedLog net472 153μs 130ns 503ns 0.687 0.229 0 4.46 KB
#6465 EnrichedLog net6.0 115μs 79.9ns 309ns 0.0575 0 0 4.28 KB
#6465 EnrichedLog netcoreapp3.1 120μs 176ns 680ns 0 0 0 4.28 KB
#6465 EnrichedLog net472 152μs 224ns 868ns 0.685 0.228 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.96μs 0.942ns 3.65ns 0.0312 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.11μs 1.58ns 6.11ns 0.0289 0 0 2.2 KB
master EnrichedLog net472 4.86μs 1.22ns 4.74ns 0.32 0 0 2.02 KB
#6465 EnrichedLog net6.0 2.91μs 10.4ns 40.4ns 0.0311 0 0 2.2 KB
#6465 EnrichedLog netcoreapp3.1 4.38μs 4.22ns 16.4ns 0.0282 0 0 2.2 KB
#6465 EnrichedLog net472 4.91μs 0.942ns 3.4ns 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.4μs 0.47ns 1.76ns 0.0162 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.82μs 8.41ns 32.6ns 0.0155 0 0 1.14 KB
master SendReceive net472 2.13μs 0.448ns 1.74ns 0.184 0 0 1.16 KB
#6465 SendReceive net6.0 1.45μs 1.18ns 4.57ns 0.016 0 0 1.14 KB
#6465 SendReceive netcoreapp3.1 1.82μs 1.14ns 4.28ns 0.0155 0 0 1.14 KB
#6465 SendReceive net472 2.1μs 0.96ns 3.72ns 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.78μs 0.78ns 2.92ns 0.0224 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.87μs 2.61ns 10.1ns 0.0213 0 0 1.65 KB
master EnrichedLog net472 4.36μs 5.45ns 21.1ns 0.324 0 0 2.04 KB
#6465 EnrichedLog net6.0 2.74μs 1.19ns 4.59ns 0.022 0 0 1.6 KB
#6465 EnrichedLog netcoreapp3.1 3.89μs 1.87ns 7.24ns 0.0214 0 0 1.65 KB
#6465 EnrichedLog net472 4.5μs 1.13ns 4.23ns 0.322 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 413ns 0.199ns 0.769ns 0.00802 0 0 576 B
master StartFinishSpan netcoreapp3.1 639ns 3.5ns 20.1ns 0.00752 0 0 576 B
master StartFinishSpan net472 660ns 0.547ns 2.12ns 0.0917 0 0 578 B
master StartFinishScope net6.0 594ns 0.422ns 1.63ns 0.00982 0 0 696 B
master StartFinishScope netcoreapp3.1 745ns 0.867ns 3.36ns 0.00932 0 0 696 B
master StartFinishScope net472 833ns 1.4ns 5.41ns 0.105 0 0 658 B
#6465 StartFinishSpan net6.0 420ns 0.44ns 1.7ns 0.00808 0 0 576 B
#6465 StartFinishSpan netcoreapp3.1 691ns 0.844ns 3.27ns 0.0077 0 0 576 B
#6465 StartFinishSpan net472 687ns 1.28ns 4.94ns 0.0917 0 0 578 B
#6465 StartFinishScope net6.0 558ns 0.246ns 0.952ns 0.0096 0 0 696 B
#6465 StartFinishScope netcoreapp3.1 739ns 0.823ns 3.08ns 0.00924 0 0 696 B
#6465 StartFinishScope net472 896ns 0.795ns 3.08ns 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 638ns 0.866ns 3.35ns 0.00963 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 894ns 0.805ns 3.12ns 0.00927 0 0 696 B
master RunOnMethodBegin net472 1.1μs 1.08ns 4.18ns 0.104 0 0 658 B
#6465 RunOnMethodBegin net6.0 644ns 0.494ns 1.91ns 0.00965 0 0 696 B
#6465 RunOnMethodBegin netcoreapp3.1 901ns 0.594ns 2.3ns 0.00939 0 0 696 B
#6465 RunOnMethodBegin net472 1.07μs 0.548ns 2.12ns 0.104 0 0 658 B

@NachoEchevarria
Copy link
Contributor Author

Thanks for your reviews!

@NachoEchevarria NachoEchevarria merged commit 1ef216b into master Dec 23, 2024
63 of 64 checks passed
@NachoEchevarria NachoEchevarria deleted the nacho/InitRulesErrorFix branch December 23, 2024 10:43
@github-actions github-actions bot added this to the vNext-v3 milestone Dec 23, 2024
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.

5 participants