Skip to content

[IAST] New sampling mechanism #6971

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

Merged
merged 11 commits into from
May 20, 2025
Merged

[IAST] New sampling mechanism #6971

merged 11 commits into from
May 20, 2025

Conversation

daniel-romano-DD
Copy link
Contributor

@daniel-romano-DD daniel-romano-DD commented May 14, 2025

Summary of changes

Created a vulnerability budget by route and vulnerability type to avoid detecting the same vulnerabilities depleting the request budget, so more vulnerabilities can be detected in subsequent calls to the same endpoint.

Reason for change

Many vulnerabilities were being skipped because of lack of budget because the same vulnerabilities were being detected in the same endpoints in the same order.

Jira ticket

RFC

Implementation details

Vulnearbility detection count has been implemented in the VulnerabilityStats struct as an inline array, with each position representing the amount of times a vulnerability type has been detected for each route.

Test coverage

Integration and unit tests have been provided

Other details

@github-actions github-actions bot added the area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) label May 14, 2025
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented May 14, 2025

Datadog Report

Branch report: dani/iast/new_sampling
Commit report: 98e889e
Test service: dd-trace-dotnet

✅ 0 Failed, 248337 Passed, 2326 Skipped, 17h 47m 51.62s Total Time

@pr-commenter
Copy link

pr-commenter bot commented May 14, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #6971 compared to master:

  • All benchmarks have the same speed
  • 5 benchmarks have fewer allocations
  • 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 ✔️ More allocations ⚠️

More allocations ⚠️ in #6971

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.11 KB 6.21 KB 98 B 1.60%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.7μs 54.2ns 254ns 0 0 0 5.54 KB
master StartStopWithChild netcoreapp3.1 14μs 45.4ns 176ns 0 0 0 5.77 KB
master StartStopWithChild net472 22.4μs 126ns 882ns 1.07 0.322 0.107 6.11 KB
#6971 StartStopWithChild net6.0 10.5μs 57.9ns 338ns 0 0 0 5.55 KB
#6971 StartStopWithChild netcoreapp3.1 13.1μs 66.8ns 313ns 0 0 0 5.75 KB
#6971 StartStopWithChild net472 22μs 118ns 657ns 0.888 0.333 0 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 928μs 51.1ns 191ns 0 0 0 2.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.04ms 199ns 772ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.22ms 82.2ns 318ns 0 0 0 3.31 KB
#6971 WriteAndFlushEnrichedTraces net6.0 930μs 78.8ns 284ns 0 0 0 2.71 KB
#6971 WriteAndFlushEnrichedTraces netcoreapp3.1 1.05ms 443ns 1.66μs 0 0 0 2.7 KB
#6971 WriteAndFlushEnrichedTraces net472 1.23ms 91.5ns 354ns 0 0 0 3.31 KB
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 333μs 1.32μs 5.1μs 0 0 0 197.06 KB
master AllCycleSimpleBody netcoreapp3.1 470μs 1.7μs 6.58μs 0 0 0 204.77 KB
master AllCycleSimpleBody net472 440μs 107ns 399ns 36.6 2.16 0 236.35 KB
master AllCycleMoreComplexBody net6.0 341μs 1.62μs 6.49μs 0 0 0 200.56 KB
master AllCycleMoreComplexBody netcoreapp3.1 501μs 1.59μs 6.15μs 0 0 0 208.18 KB
master AllCycleMoreComplexBody net472 448μs 159ns 615ns 37.9 2.23 0 239.88 KB
master ObjectExtractorSimpleBody net6.0 315ns 1.61ns 7.22ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 396ns 2.14ns 11.5ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 303ns 0.0535ns 0.207ns 0.0441 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.45μs 30.2ns 117ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.73μs 36.6ns 146ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.71μs 3.95ns 15.3ns 0.572 0 0 3.8 KB
#6971 AllCycleSimpleBody net6.0 328μs 1.75μs 8.75μs 0 0 0 197.06 KB
#6971 AllCycleSimpleBody netcoreapp3.1 492μs 901ns 3.49μs 0 0 0 204.77 KB
#6971 AllCycleSimpleBody net472 438μs 403ns 1.56μs 36.6 2.16 0 236.35 KB
#6971 AllCycleMoreComplexBody net6.0 335μs 111ns 416ns 0 0 0 200.56 KB
#6971 AllCycleMoreComplexBody netcoreapp3.1 495μs 1.15μs 4.44μs 0 0 0 208.18 KB
#6971 AllCycleMoreComplexBody net472 448μs 435ns 1.68μs 37.9 2.23 0 239.88 KB
#6971 ObjectExtractorSimpleBody net6.0 320ns 1.78ns 10.8ns 0 0 0 280 B
#6971 ObjectExtractorSimpleBody netcoreapp3.1 405ns 0.57ns 2.21ns 0 0 0 272 B
#6971 ObjectExtractorSimpleBody net472 302ns 0.0317ns 0.114ns 0.0445 0 0 281 B
#6971 ObjectExtractorMoreComplexBody net6.0 6.22μs 25.2ns 97.8ns 0 0 0 3.78 KB
#6971 ObjectExtractorMoreComplexBody netcoreapp3.1 7.7μs 34.5ns 120ns 0 0 0 3.69 KB
#6971 ObjectExtractorMoreComplexBody net472 6.73μs 5.29ns 20.5ns 0.572 0 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Unknown 🤷 Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EncodeArgs net6.0 N/A N/A N/A NaN NaN NaN 0 b
master EncodeArgs netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
master EncodeArgs net472 N/A N/A N/A NaN NaN NaN 0 b
master EncodeLegacyArgs net6.0 N/A N/A N/A NaN NaN NaN 0 b
master EncodeLegacyArgs netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
master EncodeLegacyArgs net472 N/A N/A N/A NaN NaN NaN 0 b
#6971 EncodeArgs net6.0 N/A N/A N/A NaN NaN NaN 0 b
#6971 EncodeArgs netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#6971 EncodeArgs net472 N/A N/A N/A NaN NaN NaN 0 b
#6971 EncodeLegacyArgs net6.0 N/A N/A N/A NaN NaN NaN 0 b
#6971 EncodeLegacyArgs netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#6971 EncodeLegacyArgs net472 N/A N/A N/A NaN NaN NaN 0 b
Benchmarks.Trace.Asm.AppSecWafBenchmark - Unknown 🤷 Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmark netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmark net472 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmarkWithAttack net6.0 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
master RunWafRealisticBenchmarkWithAttack net472 N/A N/A N/A NaN NaN NaN 0 b
#6971 RunWafRealisticBenchmark net6.0 N/A N/A N/A NaN NaN NaN 0 b
#6971 RunWafRealisticBenchmark netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#6971 RunWafRealisticBenchmark net472 N/A N/A N/A NaN NaN NaN 0 b
#6971 RunWafRealisticBenchmarkWithAttack net6.0 N/A N/A N/A NaN NaN NaN 0 b
#6971 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#6971 RunWafRealisticBenchmarkWithAttack net472 N/A N/A N/A NaN NaN NaN 0 b
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 61.7μs 299ns 1.27μs 0 0 0 14.53 KB
master SendRequest netcoreapp3.1 72.2μs 378ns 1.81μs 0 0 0 17.42 KB
master SendRequest net472 0.00104ns 0.000914ns 0.00354ns 0 0 0 0 b
#6971 SendRequest net6.0 60.7μs 93.6ns 350ns 0 0 0 14.53 KB
#6971 SendRequest netcoreapp3.1 70.9μs 85.8ns 332ns 0 0 0 17.42 KB
#6971 SendRequest net472 0.0129ns 0.00243ns 0.00941ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #6971

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 42.05 KB 41.72 KB -328 B -0.78%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 701μs 3.02μs 11.3μs 0 0 0 42.05 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 703μs 4.05μs 33.9μs 0 0 0 41.8 KB
master WriteAndFlushEnrichedTraces net472 874μs 3.83μs 14.3μs 4.81 0 0 56.27 KB
#6971 WriteAndFlushEnrichedTraces net6.0 678μs 1.18μs 4.43μs 0 0 0 41.72 KB
#6971 WriteAndFlushEnrichedTraces netcoreapp3.1 680μs 3.11μs 12μs 0 0 0 41.96 KB
#6971 WriteAndFlushEnrichedTraces net472 921μs 3.63μs 13.6μs 4.81 0 0 56.05 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.97μs 6.87ns 26.6ns 0 0 0 1.03 KB
master ExecuteNonQuery netcoreapp3.1 2.42μs 9.7ns 37.6ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.78μs 3.72ns 14.4ns 0.152 0.0138 0 995 B
#6971 ExecuteNonQuery net6.0 2.04μs 7.76ns 29.1ns 0 0 0 1.03 KB
#6971 ExecuteNonQuery netcoreapp3.1 2.43μs 9.83ns 38.1ns 0 0 0 1.02 KB
#6971 ExecuteNonQuery net472 2.69μs 2.97ns 11.5ns 0.146 0.0133 0 995 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.72μs 8.2ns 32.8ns 0 0 0 1.04 KB
master CallElasticsearch netcoreapp3.1 2.26μs 8.03ns 31.1ns 0 0 0 1.04 KB
master CallElasticsearch net472 3.54μs 1.64ns 6.15ns 0.16 0 0 1.05 KB
master CallElasticsearchAsync net6.0 1.9μs 9.26ns 40.4ns 0 0 0 1.02 KB
master CallElasticsearchAsync netcoreapp3.1 2.4μs 6.33ns 24.5ns 0 0 0 1.09 KB
master CallElasticsearchAsync net472 3.75μs 1.9ns 7.36ns 0.169 0 0 1.11 KB
#6971 CallElasticsearch net6.0 1.79μs 8.56ns 36.3ns 0 0 0 1.04 KB
#6971 CallElasticsearch netcoreapp3.1 2.34μs 11.6ns 53.4ns 0 0 0 1.04 KB
#6971 CallElasticsearch net472 3.57μs 2.96ns 11.4ns 0.16 0 0 1.05 KB
#6971 CallElasticsearchAsync net6.0 1.79μs 6.53ns 25.3ns 0 0 0 1.02 KB
#6971 CallElasticsearchAsync netcoreapp3.1 2.36μs 10.3ns 39.9ns 0 0 0 1.09 KB
#6971 CallElasticsearchAsync net472 3.77μs 4.63ns 17.9ns 0.17 0 0 1.11 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.85μs 2.98ns 11.5ns 0 0 0 960 B
master ExecuteAsync netcoreapp3.1 2.42μs 3.18ns 11.9ns 0 0 0 960 B
master ExecuteAsync net472 2.55μs 1.43ns 5.56ns 0.141 0 0 923 B
#6971 ExecuteAsync net6.0 1.99μs 5.55ns 20.8ns 0 0 0 960 B
#6971 ExecuteAsync netcoreapp3.1 2.33μs 9.41ns 36.4ns 0 0 0 960 B
#6971 ExecuteAsync net472 2.55μs 2.98ns 11.5ns 0.139 0 0 923 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 7.01μs 27.7ns 104ns 0 0 0 2.37 KB
master SendAsync netcoreapp3.1 8.64μs 17.6ns 68.2ns 0 0 0 2.9 KB
master SendAsync net472 12.2μs 6.94ns 26.9ns 0.491 0 0 3.19 KB
#6971 SendAsync net6.0 7.06μs 20.4ns 73.5ns 0 0 0 2.37 KB
#6971 SendAsync netcoreapp3.1 8.51μs 23.5ns 90.9ns 0 0 0 2.9 KB
#6971 SendAsync net472 12.2μs 13.1ns 50.7ns 0.484 0 0 3.19 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #6971

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 257.04 KB 255.29 KB -1.75 KB -0.68%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 43.23 KB 42.78 KB -448 B -1.04%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 286.72 KB 278.53 KB -8.19 KB -2.86%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 44.86 KB 43.15 KB -1.71 KB -3.82%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 44.1μs 246ns 1.48μs 0 0 0 44.86 KB
master StringConcatBenchmark netcoreapp3.1 50.1μs 294ns 2.5μs 0 0 0 43.23 KB
master StringConcatBenchmark net472 57.4μs 274ns 1.13μs 0 0 0 57.34 KB
master StringConcatAspectBenchmark net6.0 488μs 2.39μs 9.87μs 0 0 0 279.33 KB
master StringConcatAspectBenchmark netcoreapp3.1 517μs 2.44μs 9.45μs 0 0 0 257.04 KB
master StringConcatAspectBenchmark net472 408μs 1.75μs 6.79μs 0 0 0 286.72 KB
#6971 StringConcatBenchmark net6.0 44.5μs 244ns 1.72μs 0 0 0 43.15 KB
#6971 StringConcatBenchmark netcoreapp3.1 50.9μs 414ns 3.99μs 0 0 0 42.78 KB
#6971 StringConcatBenchmark net472 57.6μs 171ns 616ns 0 0 0 57.34 KB
#6971 StringConcatAspectBenchmark net6.0 477μs 2.05μs 7.12μs 0 0 0 279.82 KB
#6971 StringConcatAspectBenchmark netcoreapp3.1 490μs 1.64μs 5.69μs 0 0 0 255.29 KB
#6971 StringConcatAspectBenchmark net472 411μs 2.13μs 9.78μs 0 0 0 278.53 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 2.64μs 14.6ns 86.1ns 0 0 0 1.76 KB
master EnrichedLog netcoreapp3.1 3.51μs 18.1ns 83ns 0 0 0 1.76 KB
master EnrichedLog net472 3.94μs 4.36ns 16.9ns 0.255 0 0 1.69 KB
#6971 EnrichedLog net6.0 2.62μs 12.4ns 48ns 0 0 0 1.76 KB
#6971 EnrichedLog netcoreapp3.1 3.41μs 2.11ns 8.16ns 0 0 0 1.76 KB
#6971 EnrichedLog net472 3.93μs 4.26ns 16.5ns 0.255 0 0 1.69 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 123μs 82.9ns 287ns 0 0 0 4.37 KB
master EnrichedLog netcoreapp3.1 128μs 103ns 399ns 0 0 0 4.37 KB
master EnrichedLog net472 167μs 73.7ns 285ns 0 0 0 4.57 KB
#6971 EnrichedLog net6.0 123μs 102ns 396ns 0 0 0 4.37 KB
#6971 EnrichedLog netcoreapp3.1 129μs 45.4ns 170ns 0 0 0 4.37 KB
#6971 EnrichedLog net472 167μs 155ns 578ns 0 0 0 4.57 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 5.04μs 14.1ns 54.4ns 0 0 0 2.32 KB
master EnrichedLog netcoreapp3.1 6.53μs 30.5ns 122ns 0 0 0 2.32 KB
master EnrichedLog net472 7.29μs 4.42ns 16.5ns 0.328 0 0 2.14 KB
#6971 EnrichedLog net6.0 4.96μs 24.3ns 103ns 0 0 0 2.32 KB
#6971 EnrichedLog netcoreapp3.1 6.6μs 19ns 68.6ns 0 0 0 2.32 KB
#6971 EnrichedLog net472 7.36μs 7.07ns 27.4ns 0.33 0 0 2.14 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 2μs 9.05ns 35.1ns 0 0 0 1.21 KB
master SendReceive netcoreapp3.1 2.56μs 9.04ns 35ns 0 0 0 1.21 KB
master SendReceive net472 3.06μs 3.46ns 13.4ns 0.182 0 0 1.21 KB
#6971 SendReceive net6.0 2.01μs 8.28ns 32.1ns 0 0 0 1.21 KB
#6971 SendReceive netcoreapp3.1 2.53μs 12.1ns 48.5ns 0 0 0 1.21 KB
#6971 SendReceive net472 3.04μs 2.87ns 11.1ns 0.183 0 0 1.21 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 4.15μs 15.1ns 54.6ns 0 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 5.62μs 13.8ns 53.5ns 0 0 0 1.69 KB
master EnrichedLog net472 6.54μs 8.89ns 34.4ns 0.324 0 0 2.08 KB
#6971 EnrichedLog net6.0 4.19μs 7.86ns 30.4ns 0 0 0 1.64 KB
#6971 EnrichedLog netcoreapp3.1 5.6μs 23.7ns 91.8ns 0 0 0 1.69 KB
#6971 EnrichedLog net472 6.5μs 6.61ns 25.6ns 0.325 0 0 2.08 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 739ns 2.59ns 9.33ns 0 0 0 584 B
master StartFinishSpan netcoreapp3.1 932ns 5.09ns 27.9ns 0 0 0 584 B
master StartFinishSpan net472 928ns 0.0935ns 0.337ns 0.0887 0 0 586 B
master StartFinishScope net6.0 907ns 4.75ns 25.2ns 0 0 0 704 B
master StartFinishScope netcoreapp3.1 1.19μs 5.89ns 25ns 0 0 0 704 B
master StartFinishScope net472 1.12μs 0.225ns 0.872ns 0.101 0 0 666 B
#6971 StartFinishSpan net6.0 750ns 3.61ns 15.8ns 0 0 0 584 B
#6971 StartFinishSpan netcoreapp3.1 935ns 0.321ns 1.24ns 0 0 0 584 B
#6971 StartFinishSpan net472 923ns 0.0794ns 0.297ns 0.0888 0 0 586 B
#6971 StartFinishScope net6.0 892ns 4.68ns 18.7ns 0 0 0 704 B
#6971 StartFinishScope netcoreapp3.1 1.17μs 6.02ns 30.1ns 0 0 0 704 B
#6971 StartFinishScope net472 1.12μs 0.977ns 3.79ns 0.105 0 0 666 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 1.02μs 0.749ns 2.9ns 0 0 0 704 B
master RunOnMethodBegin netcoreapp3.1 1.34μs 6.54ns 28.5ns 0 0 0 704 B
master RunOnMethodBegin net472 1.39μs 0.977ns 3.78ns 0.105 0 0 666 B
#6971 RunOnMethodBegin net6.0 1.02μs 2.98ns 11.6ns 0 0 0 704 B
#6971 RunOnMethodBegin netcoreapp3.1 1.37μs 6.44ns 24.9ns 0 0 0 704 B
#6971 RunOnMethodBegin net472 1.38μs 1.98ns 7.69ns 0.103 0 0 666 B

@andrewlock
Copy link
Member

andrewlock commented May 14, 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.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6971) - mean (68ms)  : 65, 71
     .   : milestone, 68,
    master - mean (68ms)  : 67, 70
     .   : milestone, 68,

    section CallTarget+Inlining+NGEN
    This PR (6971) - mean (1,012ms)  : 988, 1037
     .   : milestone, 1012,
    master - mean (999ms)  : 982, 1017
     .   : milestone, 999,

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

    section CallTarget+Inlining+NGEN
    This PR (6971) - mean (695ms)  : 677, 714
     .   : milestone, 695,
    master - mean (690ms)  : 670, 711
     .   : milestone, 690,

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

    section CallTarget+Inlining+NGEN
    This PR (6971) - mean (657ms)  : 632, 681
     .   : milestone, 657,
    master - mean (658ms)  : 636, 679
     .   : milestone, 658,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6971) - mean (189ms)  : 185, 193
     .   : milestone, 189,
    master - mean (189ms)  : 185, 193
     .   : milestone, 189,

    section CallTarget+Inlining+NGEN
    This PR (6971) - mean (1,108ms)  : 1078, 1138
     .   : milestone, 1108,
    master - mean (1,106ms)  : 1083, 1129
     .   : milestone, 1106,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (6971) - mean (268ms)  : 264, 271
     .   : milestone, 268,
    master - mean (268ms)  : 264, 272
     .   : milestone, 268,

    section CallTarget+Inlining+NGEN
    This PR (6971) - mean (879ms)  : 838, 921
     .   : milestone, 879,
    master - mean (880ms)  : 842, 918
     .   : milestone, 880,

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

    section CallTarget+Inlining+NGEN
    This PR (6971) - mean (869ms)  : 836, 901
     .   : milestone, 869,
    master - mean (863ms)  : 833, 893
     .   : milestone, 863,

Loading

@daniel-romano-DD daniel-romano-DD marked this pull request as ready for review May 15, 2025 08:28
@daniel-romano-DD daniel-romano-DD requested a review from a team as a code owner May 15, 2025 08:28
{
var route = span.GetTag(Tags.HttpRoute) ?? string.Empty;
var method = span.GetTag(Tags.HttpMethod) ?? string.Empty;
var key = $"{route}:{method}";
Copy link

Choose a reason for hiding this comment

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

I'd suggest to you using the # as separator and setting the method (GET,POST) at the beginning.
I think that a route with path param could contain : chars, like /route/:param so # seems safer, and also seems safer and more natural having the method at the beginning.

Suggested change
var key = $"{route}:{method}";
var key = $"{method}#{route}";

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 :

-    },
-    {
-      "type": "NO_SAMESITE_COOKIE",
-      "hash": -636226626,
-      "evidence": {
-        "value": "LongCookie.abcdefghijklmnopqrstuvwxyz0123456789.0"
-      }
-    },
-    {
-      "type": "NO_HTTPONLY_COOKIE",
-      "hash": -60481650,
-      "evidence": {
-        "value": "LongCookie.abcdefghijklmnopqrstuvwxyz0123456789.0"
-      }
-    },
-    {
-      "type": "INSECURE_COOKIE",
-      "hash": 990913114,
-      "evidence": {
-        "value": "LongCookie.abcdefghijklmnopqrstuvwxyz0123456789.0"
-      }
-    },
-    {
-      "type": "NO_SAMESITE_COOKIE",
-      "hash": -636226626,
-      "evidence": {
-        "value": "LongCookie.abcdefghijklmnopqrstuvwxyz0123456789.1"
-      }
-    },
-    {
-      "type": "NO_HTTPONLY_COOKIE",
-      "hash": -60481650,
-      "evidence": {
-        "value": "LongCookie.abcdefghijklmnopqrstuvwxyz0123456789.1"
-      }
-    },
-    {
-      "type": "INSECURE_COOKIE",
-      "hash": 990913114,
-      "evidence": {
-        "value": "LongCookie.abcdefghijklmnopqrstuvwxyz0123456789.1"
-      }
-    },
-    {
-      "type": "NO_SAMESITE_COOKIE",
-      "hash": -636226626,
-      "evidence": {
-        "value": "LongCookie.abcdefghijklmnopqrstuvwxyz0123456789.2"
-      }
-    },
-    {
-      "type": "NO_HTTPONLY_COOKIE",
-      "hash": -60481650,
-      "evidence": {
-        "value": "LongCookie.abcdefghijklmnopqrstuvwxyz0123456789.2"
-      }
-    },
-    {
-      "type": "INSECURE_COOKIE",
-      "hash": 990913114,
-      "evidence": {
-        "value": "LongCookie.abcdefghijklmnopqrstuvwxyz0123456789.2"
-      }

@daniel-romano-DD daniel-romano-DD force-pushed the dani/iast/new_sampling branch from 4b7e9d6 to 8a80042 Compare May 16, 2025 10:31
@daniel-romano-DD daniel-romano-DD force-pushed the dani/iast/new_sampling branch from fe53075 to 98e889e Compare May 20, 2025 08:03
@daniel-romano-DD daniel-romano-DD merged commit cf8d5a4 into master May 20, 2025
126 of 127 checks passed
@daniel-romano-DD daniel-romano-DD deleted the dani/iast/new_sampling branch May 20, 2025 11:28
@github-actions github-actions bot added this to the vNext-v3 milestone May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:asm-iast area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants