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] Add rules version to all root spans when ASM enabled #6188

Merged
merged 6 commits into from
Oct 24, 2024

Conversation

NachoEchevarria
Copy link
Contributor

@NachoEchevarria NachoEchevarria commented Oct 23, 2024

Summary of changes

This PR adds the _dd.appsec.event_rules.version tag to all the spans when ASM is enabled. This has been requested by the RASP WG and is consistent with the behavior of other libraries.

Reason for change

Implementation details

Test coverage

Other details

@NachoEchevarria NachoEchevarria changed the title Add rules version to all spans when ASM enabled [ASM] Add rules version to all spans when ASM enabled Oct 23, 2024
Copy link
Contributor

github-actions bot commented Oct 23, 2024

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.event_rules.version": "1.13.1",

15 occurrences of :

+      _dd.appsec.event_rules.version: 1.13.1,

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Oct 23, 2024

Datadog Report

Branch report: nacho/ReportRulesVersionWhenASMEnabled
Commit report: dc592ff
Test service: dd-trace-dotnet

✅ 0 Failed, 371928 Passed, 2089 Skipped, 15h 24m 54.2s Total Time

@andrewlock
Copy link
Member

andrewlock commented Oct 23, 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 (6188) - mean (71ms)  : 68, 74
     .   : milestone, 71,
    master - mean (70ms)  : 68, 72
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (6188) - mean (1,118ms)  : 1098, 1139
     .   : milestone, 1118,
    master - mean (1,112ms)  : 1086, 1139
     .   : milestone, 1112,

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

    section CallTarget+Inlining+NGEN
    This PR (6188) - mean (778ms)  : 765, 791
     .   : milestone, 778,
    master - mean (773ms)  : 760, 787
     .   : milestone, 773,

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

    section CallTarget+Inlining+NGEN
    This PR (6188) - mean (730ms)  : 715, 745
     .   : milestone, 730,
    master - mean (727ms)  : 714, 740
     .   : milestone, 727,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6188) - mean (193ms)  : 179, 207
     .   : milestone, 193,
    master - mean (190ms)  : 188, 192
     .   : milestone, 190,

    section CallTarget+Inlining+NGEN
    This PR (6188) - mean (1,203ms)  : 1179, 1228
     .   : milestone, 1203,
    master - mean (1,202ms)  : 1176, 1227
     .   : milestone, 1202,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6188) - mean (275ms)  : 272, 279
     .   : milestone, 275,
    master - mean (276ms)  : 270, 282
     .   : milestone, 276,

    section CallTarget+Inlining+NGEN
    This PR (6188) - mean (945ms)  : 924, 966
     .   : milestone, 945,
    master - mean (945ms)  : 925, 965
     .   : milestone, 945,

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

    section CallTarget+Inlining+NGEN
    This PR (6188) - mean (930ms)  : 912, 949
     .   : milestone, 930,
    master - mean (926ms)  : 909, 944
     .   : milestone, 926,

Loading

@andrewlock
Copy link
Member

andrewlock commented Oct 23, 2024

Benchmarks Report for appsec 🐌

Benchmarks for #6188 compared to master:

  • All benchmarks have the same speed
  • 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 - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 72.1μs 80.4ns 312ns 0.0718 0 0 6.01 KB
master AllCycleSimpleBody netcoreapp3.1 61.6μs 54.9ns 205ns 0.0922 0 0 6.95 KB
master AllCycleSimpleBody net472 48.1μs 77.7ns 301ns 1.3 0 0 8.34 KB
master AllCycleMoreComplexBody net6.0 80.1μs 151ns 586ns 0.117 0 0 9.51 KB
master AllCycleMoreComplexBody netcoreapp3.1 70.3μs 80.6ns 312ns 0.14 0 0 10.36 KB
master AllCycleMoreComplexBody net472 55.9μs 95.7ns 370ns 1.88 0.0277 0 11.85 KB
master ObjectExtractorSimpleBody net6.0 142ns 0.251ns 0.972ns 0.00396 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 197ns 0.15ns 0.542ns 0.00378 0 0 272 B
master ObjectExtractorSimpleBody net472 166ns 0.13ns 0.504ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 3.23μs 1.77ns 6.87ns 0.0532 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 3.9μs 1.59ns 6.15ns 0.0505 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 3.76μs 2.15ns 8.05ns 0.603 0.00565 0 3.8 KB
#6188 AllCycleSimpleBody net6.0 73.5μs 122ns 474ns 0.0725 0 0 6 KB
#6188 AllCycleSimpleBody netcoreapp3.1 64.4μs 102ns 395ns 0.0954 0 0 6.95 KB
#6188 AllCycleSimpleBody net472 49μs 69.6ns 261ns 1.32 0 0 8.34 KB
#6188 AllCycleMoreComplexBody net6.0 80μs 51.6ns 179ns 0.12 0 0 9.51 KB
#6188 AllCycleMoreComplexBody netcoreapp3.1 71.4μs 95.4ns 344ns 0.143 0 0 10.37 KB
#6188 AllCycleMoreComplexBody net472 55.5μs 94.3ns 365ns 1.87 0.0276 0 11.85 KB
#6188 ObjectExtractorSimpleBody net6.0 142ns 0.29ns 1.09ns 0.00394 0 0 280 B
#6188 ObjectExtractorSimpleBody netcoreapp3.1 196ns 0.297ns 1.07ns 0.00367 0 0 272 B
#6188 ObjectExtractorSimpleBody net472 167ns 0.165ns 0.593ns 0.0446 0 0 281 B
#6188 ObjectExtractorMoreComplexBody net6.0 3.21μs 1.65ns 6.17ns 0.0538 0 0 3.78 KB
#6188 ObjectExtractorMoreComplexBody netcoreapp3.1 4.03μs 2.21ns 8.27ns 0.0508 0 0 3.69 KB
#6188 ObjectExtractorMoreComplexBody net472 3.8μs 3.66ns 13.7ns 0.602 0.0057 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 36.7μs 19.4ns 75.1ns 0.459 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 54.2μs 14.9ns 55.8ns 0.431 0 0 32.4 KB
master EncodeArgs net472 65.4μs 37.4ns 140ns 5.15 0.0652 0 32.5 KB
master EncodeLegacyArgs net6.0 71.9μs 62.9ns 244ns 0 0 0 2.14 KB
master EncodeLegacyArgs netcoreapp3.1 107μs 322ns 1.25μs 0 0 0 2.15 KB
master EncodeLegacyArgs net472 152μs 45.5ns 164ns 0.304 0 0 2.15 KB
#6188 EncodeArgs net6.0 37.3μs 19.4ns 75ns 0.447 0 0 32.4 KB
#6188 EncodeArgs netcoreapp3.1 54.7μs 14.8ns 55.5ns 0.436 0 0 32.4 KB
#6188 EncodeArgs net472 67.4μs 21.9ns 81.9ns 5.14 0.0677 0 32.5 KB
#6188 EncodeLegacyArgs net6.0 72.5μs 34.2ns 132ns 0 0 0 2.14 KB
#6188 EncodeLegacyArgs netcoreapp3.1 108μs 83.2ns 311ns 0 0 0 2.14 KB
#6188 EncodeLegacyArgs net472 154μs 51.1ns 198ns 0.307 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 187μs 284ns 1.1μs 0 0 0 2.44 KB
master RunWafRealisticBenchmark netcoreapp3.1 197μs 164ns 636ns 0 0 0 2.39 KB
master RunWafRealisticBenchmark net472 208μs 145ns 560ns 0.31 0 0 2.46 KB
master RunWafRealisticBenchmarkWithAttack net6.0 123μs 93.3ns 361ns 0 0 0 1.47 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 132μs 209ns 809ns 0 0 0 1.46 KB
master RunWafRealisticBenchmarkWithAttack net472 138μs 96.4ns 361ns 0.207 0 0 1.49 KB
#6188 RunWafRealisticBenchmark net6.0 188μs 129ns 500ns 0 0 0 2.44 KB
#6188 RunWafRealisticBenchmark netcoreapp3.1 199μs 341ns 1.32μs 0 0 0 2.39 KB
#6188 RunWafRealisticBenchmark net472 211μs 255ns 987ns 0.314 0 0 2.46 KB
#6188 RunWafRealisticBenchmarkWithAttack net6.0 123μs 73.6ns 285ns 0 0 0 1.47 KB
#6188 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 130μs 89.2ns 334ns 0 0 0 1.46 KB
#6188 RunWafRealisticBenchmarkWithAttack net472 141μs 172ns 666ns 0.211 0 0 1.49 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #6188

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 59.36 KB 59.04 KB -320 B -0.54%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 255.63 KB 254.03 KB -1.6 KB -0.63%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 61.3μs 829ns 8.29μs 0 0 0 43.44 KB
master StringConcatBenchmark netcoreapp3.1 59.5μs 742ns 7.39μs 0 0 0 42.64 KB
master StringConcatBenchmark net472 37.8μs 105ns 380ns 0 0 0 59.36 KB
master StringConcatAspectBenchmark net6.0 314μs 1.43μs 5.36μs 0 0 0 255.63 KB
master StringConcatAspectBenchmark netcoreapp3.1 321μs 3.06μs 28.4μs 0 0 0 252.93 KB
master StringConcatAspectBenchmark net472 275μs 6.31μs 60.9μs 0 0 0 278.53 KB
#6188 StringConcatBenchmark net6.0 60.7μs 595ns 5.89μs 0 0 0 43.44 KB
#6188 StringConcatBenchmark netcoreapp3.1 53.9μs 256ns 958ns 0 0 0 42.64 KB
#6188 StringConcatBenchmark net472 37.3μs 102ns 383ns 0 0 0 59.04 KB
#6188 StringConcatAspectBenchmark net6.0 308μs 1.67μs 8.84μs 0 0 0 254.03 KB
#6188 StringConcatAspectBenchmark netcoreapp3.1 339μs 1.83μs 14.2μs 0 0 0 253.9 KB
#6188 StringConcatAspectBenchmark net472 281μs 6.7μs 64.6μs 0 0 0 278.53 KB

@andrewlock
Copy link
Member

andrewlock commented Oct 23, 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 (6188) (11.165M)   : 0, 11164838
    master (11.173M)   : 0, 11173055
    benchmarks/2.9.0 (11.081M)   : 0, 11080577

    section Automatic
    This PR (6188) (7.363M)   : 0, 7363031
    master (7.413M)   : 0, 7412704
    benchmarks/2.9.0 (7.732M)   : 0, 7732233

    section Trace stats
    master (7.618M)   : 0, 7617811

    section Manual
    master (11.131M)   : 0, 11131145

    section Manual + Automatic
    This PR (6188) (6.829M)   : 0, 6829105
    master (6.777M)   : 0, 6776931

    section DD_TRACE_ENABLED=0
    master (10.230M)   : 0, 10230054

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6188) (9.621M)   : 0, 9621343
    master (9.535M)   : 0, 9534894
    benchmarks/2.9.0 (9.798M)   : 0, 9798067

    section Automatic
    This PR (6188) (6.758M)   : 0, 6758156
    master (6.561M)   : 0, 6560760

    section Trace stats
    master (6.754M)   : 0, 6753895

    section Manual
    master (9.505M)   : 0, 9505267

    section Manual + Automatic
    This PR (6188) (6.204M)   : 0, 6204125
    master (5.982M)   : 0, 5982216

    section DD_TRACE_ENABLED=0
    master (8.781M)   : 0, 8780682

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6188) (9.967M)   : 0, 9966818
    master (9.831M)   : 0, 9831311
    benchmarks/2.9.0 (10.067M)   : 0, 10067315

    section Automatic
    This PR (6188) (6.688M)   : 0, 6688222
    master (6.589M)   : 0, 6589279
    benchmarks/2.9.0 (7.552M)   : 0, 7552193

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

    section Manual
    master (10.014M)   : 0, 10014131

    section Manual + Automatic
    This PR (6188) (6.109M)   : 0, 6108548
    master (6.181M)   : 0, 6181145

    section DD_TRACE_ENABLED=0
    master (9.100M)   : 0, 9100382

Loading

@andrewlock
Copy link
Member

Benchmarks Report for tracer 🐌

Benchmarks for #6188 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.147
  • 1 benchmarks are slower, with geometric mean 1.147
  • 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.73μs 43.6ns 296ns 0.016 0.00799 0 5.43 KB
master StartStopWithChild netcoreapp3.1 9.86μs 48.1ns 204ns 0.0192 0.00959 0 5.62 KB
master StartStopWithChild net472 16.2μs 74.6ns 299ns 1.02 0.309 0.0975 6.06 KB
#6188 StartStopWithChild net6.0 7.71μs 40.9ns 275ns 0.0153 0.00766 0 5.43 KB
#6188 StartStopWithChild netcoreapp3.1 9.97μs 53.9ns 290ns 0.02 0.01 0 5.62 KB
#6188 StartStopWithChild net472 16.4μs 44.7ns 167ns 1.02 0.314 0.099 6.06 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 517μs 218ns 817ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 643μs 343ns 1.33μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 840μs 533ns 2.06μs 0.419 0 0 3.3 KB
#6188 WriteAndFlushEnrichedTraces net6.0 491μs 135ns 468ns 0 0 0 2.7 KB
#6188 WriteAndFlushEnrichedTraces netcoreapp3.1 626μs 288ns 1.12μs 0 0 0 2.7 KB
#6188 WriteAndFlushEnrichedTraces net472 838μs 376ns 1.46μs 0.419 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 201μs 1.14μs 9.58μs 0.231 0 0 18.45 KB
master SendRequest netcoreapp3.1 223μs 1.3μs 11.7μs 0.216 0 0 20.61 KB
master SendRequest net472 0.000962ns 0.000263ns 0.00095ns 0 0 0 0 b
#6188 SendRequest net6.0 197μs 1.08μs 7.48μs 0.184 0 0 18.45 KB
#6188 SendRequest netcoreapp3.1 218μs 1.26μs 10μs 0.217 0 0 20.61 KB
#6188 SendRequest net472 9.62E‑05ns 9.62E‑05ns 0.00036ns 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 550μs 1.47μs 5.11μs 0.566 0 0 41.65 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 676μs 2.66μs 9.94μs 0.343 0 0 41.93 KB
master WriteAndFlushEnrichedTraces net472 862μs 3.49μs 13.5μs 8.45 2.53 0.422 53.31 KB
#6188 WriteAndFlushEnrichedTraces net6.0 584μs 3.15μs 16.4μs 0.556 0 0 41.73 KB
#6188 WriteAndFlushEnrichedTraces netcoreapp3.1 690μs 3.15μs 12.2μs 0.347 0 0 41.76 KB
#6188 WriteAndFlushEnrichedTraces net472 874μs 4.03μs 16.1μs 8.15 2.26 0.453 53.32 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.38μs 1.32ns 5.11ns 0.0144 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.74μs 0.944ns 3.66ns 0.0138 0 0 1.02 KB
master ExecuteNonQuery net472 2.1μs 2.18ns 8.42ns 0.157 0 0 987 B
#6188 ExecuteNonQuery net6.0 1.27μs 0.738ns 2.86ns 0.0145 0 0 1.02 KB
#6188 ExecuteNonQuery netcoreapp3.1 1.72μs 1.3ns 5.04ns 0.0138 0 0 1.02 KB
#6188 ExecuteNonQuery net472 2.14μs 2.71ns 10.5ns 0.157 0 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.16μs 0.43ns 1.61ns 0.0134 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.53μs 0.598ns 2.07ns 0.0137 0 0 976 B
master CallElasticsearch net472 2.56μs 2.04ns 7.89ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.45μs 0.481ns 1.8ns 0.0131 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.71μs 0.783ns 2.93ns 0.0138 0 0 1.02 KB
master CallElasticsearchAsync net472 2.64μs 0.885ns 3.31ns 0.166 0 0 1.05 KB
#6188 CallElasticsearch net6.0 1.17μs 0.494ns 1.85ns 0.014 0 0 976 B
#6188 CallElasticsearch netcoreapp3.1 1.54μs 2.61ns 9.78ns 0.0132 0 0 976 B
#6188 CallElasticsearch net472 2.61μs 3.43ns 13.3ns 0.158 0 0 995 B
#6188 CallElasticsearchAsync net6.0 1.35μs 0.571ns 2.21ns 0.0135 0 0 952 B
#6188 CallElasticsearchAsync netcoreapp3.1 1.68μs 0.951ns 3.43ns 0.0135 0 0 1.02 KB
#6188 CallElasticsearchAsync net472 2.55μs 2.81ns 10.9ns 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.26μs 0.698ns 2.7ns 0.0133 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.63μs 0.913ns 3.54ns 0.0123 0 0 952 B
master ExecuteAsync net472 1.78μs 0.679ns 2.63ns 0.145 0 0 915 B
#6188 ExecuteAsync net6.0 1.25μs 0.436ns 1.63ns 0.0131 0 0 952 B
#6188 ExecuteAsync netcoreapp3.1 1.65μs 0.677ns 2.53ns 0.0124 0 0 952 B
#6188 ExecuteAsync net472 1.71μs 0.487ns 1.89ns 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.25μs 1.25ns 4.83ns 0.0297 0 0 2.22 KB
master SendAsync netcoreapp3.1 5.15μs 3.64ns 14.1ns 0.0361 0 0 2.76 KB
master SendAsync net472 7.82μs 1.25ns 4.68ns 0.497 0 0 3.15 KB
#6188 SendAsync net6.0 4.18μs 1.55ns 5.81ns 0.0318 0 0 2.22 KB
#6188 SendAsync netcoreapp3.1 5.08μs 1.18ns 4.43ns 0.0354 0 0 2.76 KB
#6188 SendAsync net472 7.76μs 3.92ns 14.7ns 0.498 0 0 3.15 KB
Benchmarks.Trace.ILoggerBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #6188

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑net6.0 1.147 1,645.10 1,434.70

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.65μs 1.65ns 6.4ns 0.0227 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.11μs 0.716ns 2.68ns 0.0221 0 0 1.64 KB
master EnrichedLog net472 2.68μs 1.33ns 5.17ns 0.249 0 0 1.57 KB
#6188 EnrichedLog net6.0 1.43μs 0.675ns 2.43ns 0.0228 0 0 1.64 KB
#6188 EnrichedLog netcoreapp3.1 2.28μs 1.24ns 4.62ns 0.0225 0 0 1.64 KB
#6188 EnrichedLog net472 2.6μs 1.39ns 5.2ns 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 153ns 594ns 0.0579 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 122μs 191ns 741ns 0 0 0 4.28 KB
master EnrichedLog net472 149μs 120ns 466ns 0.674 0.225 0 4.46 KB
#6188 EnrichedLog net6.0 117μs 257ns 997ns 0.0582 0 0 4.28 KB
#6188 EnrichedLog netcoreapp3.1 122μs 99.7ns 360ns 0 0 0 4.28 KB
#6188 EnrichedLog net472 152μs 161ns 624ns 0.687 0.229 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 0.781ns 3.03ns 0.031 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.16μs 1.1ns 4.25ns 0.0291 0 0 2.2 KB
master EnrichedLog net472 4.75μs 2.05ns 7.95ns 0.321 0 0 2.02 KB
#6188 EnrichedLog net6.0 3.12μs 1.38ns 5.35ns 0.0297 0 0 2.2 KB
#6188 EnrichedLog netcoreapp3.1 4.26μs 0.826ns 3.2ns 0.0298 0 0 2.2 KB
#6188 EnrichedLog net472 4.95μs 1.46ns 5.67ns 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.34μs 1.24ns 4.82ns 0.0161 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.7μs 0.574ns 2.15ns 0.0146 0 0 1.14 KB
master SendReceive net472 2.29μs 0.971ns 3.63ns 0.183 0.00115 0 1.16 KB
#6188 SendReceive net6.0 1.48μs 1.64ns 6.35ns 0.0162 0 0 1.14 KB
#6188 SendReceive netcoreapp3.1 1.78μs 0.718ns 2.69ns 0.0151 0 0 1.14 KB
#6188 SendReceive net472 2.22μs 1.83ns 7.09ns 0.183 0.0011 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.77μs 1ns 3.88ns 0.0223 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.99μs 1.67ns 6.47ns 0.0219 0 0 1.65 KB
master EnrichedLog net472 4.47μs 1.07ns 4.14ns 0.322 0 0 2.04 KB
#6188 EnrichedLog net6.0 2.74μs 8.79ns 34ns 0.0216 0 0 1.6 KB
#6188 EnrichedLog netcoreapp3.1 3.84μs 2.16ns 8.36ns 0.021 0 0 1.65 KB
#6188 EnrichedLog net472 4.42μs 4ns 15.5ns 0.323 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6188

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 1.147 476.13 546.26

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 420ns 0.237ns 0.917ns 0.00806 0 0 576 B
master StartFinishSpan netcoreapp3.1 612ns 0.556ns 2.08ns 0.00786 0 0 576 B
master StartFinishSpan net472 706ns 0.537ns 2.08ns 0.0918 0 0 578 B
master StartFinishScope net6.0 476ns 0.391ns 1.52ns 0.00976 0 0 696 B
master StartFinishScope netcoreapp3.1 700ns 0.817ns 3.16ns 0.00963 0 0 696 B
master StartFinishScope net472 846ns 0.938ns 3.63ns 0.104 0 0 658 B
#6188 StartFinishSpan net6.0 394ns 0.108ns 0.417ns 0.00814 0 0 576 B
#6188 StartFinishSpan netcoreapp3.1 587ns 0.736ns 2.85ns 0.0076 0 0 576 B
#6188 StartFinishSpan net472 664ns 0.524ns 2.03ns 0.0916 0 0 578 B
#6188 StartFinishScope net6.0 549ns 1.46ns 5.66ns 0.00971 0 0 696 B
#6188 StartFinishScope netcoreapp3.1 713ns 0.471ns 1.82ns 0.00921 0 0 696 B
#6188 StartFinishScope net472 857ns 0.515ns 1.99ns 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 587ns 0.62ns 2.4ns 0.00967 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 880ns 0.765ns 2.86ns 0.0092 0 0 696 B
master RunOnMethodBegin net472 1.17μs 1.09ns 4.21ns 0.105 0 0 658 B
#6188 RunOnMethodBegin net6.0 592ns 0.336ns 1.3ns 0.0096 0 0 696 B
#6188 RunOnMethodBegin netcoreapp3.1 887ns 1.18ns 4.42ns 0.00923 0 0 696 B
#6188 RunOnMethodBegin net472 1.12μs 1.1ns 4.27ns 0.105 0 0 658 B

Copy link
Member

@andrewlock andrewlock left a comment

Choose a reason for hiding this comment

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

LGTM, but just an FYI, for fixed things like this you might want to consider switching to doing this in the span serializer. We do this for the tracer for performance reasons, and given that you always are using the slow path (the Tags dictionary) you could see some significant improvements 🤔

@NachoEchevarria NachoEchevarria marked this pull request as ready for review October 24, 2024 12:57
@NachoEchevarria NachoEchevarria requested review from a team as code owners October 24, 2024 12:57
@NachoEchevarria
Copy link
Contributor Author

Thanks for the reviews!

@NachoEchevarria NachoEchevarria merged commit 47efb3e into master Oct 24, 2024
74 of 76 checks passed
@NachoEchevarria NachoEchevarria deleted the nacho/ReportRulesVersionWhenASMEnabled branch October 24, 2024 12:58
@github-actions github-actions bot added this to the vNext-v3 milestone Oct 24, 2024
@anna-git
Copy link
Contributor

LGTM, but just an FYI, for fixed things like this you might want to consider switching to doing this in the span serializer. We do this for the tracer for performance reasons, and given that you always are using the slow path (the Tags dictionary) you could see some significant improvements 🤔

fwiw https://datadoghq.atlassian.net/browse/APPSEC-55545

@lucaspimentel lucaspimentel changed the title [ASM] Add rules version to all spans when ASM enabled [ASM] Add rules version to all root spans when ASM enabled Nov 12, 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.

3 participants