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] Normalise aspects exception logging #6495

Merged
merged 5 commits into from
Jan 4, 2025
Merged

Conversation

e-n-0
Copy link
Member

@e-n-0 e-n-0 commented Jan 2, 2025

Summary of changes

  • Update in all aspects catch exception block the exception error logging to IastModule.LogAspectException.
  • IastModule.LogAspectException in the IastModule that will only print out an error one time

Reason for change

Implementation details

There is a new hash set of errors printed (based on their HashCode) so an error is only printed out only one time.

Test coverage

  • Updated Analyzer

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Jan 2, 2025

Datadog Report

Branch report: flavien/iast-aspects-logging
Commit report: d47d8ec
Test service: dd-trace-dotnet

✅ 0 Failed, 225041 Passed, 2064 Skipped, 21h 4m 41.95s Total Time
❄️ 4 New Flaky

New Flaky Tests (4)

  • EarlyFlakeDetection - Datadog.Trace.ClrProfiler.IntegrationTests.CI.MsTestV2EvpTests - Last Failure

    Expand for error
     The sample did not exit in 600000ms. Memory dump taken: True. Killing process.
    
  • EarlyFlakeDetection - Datadog.Trace.ClrProfiler.IntegrationTests.CI.NUnitEvpTests - Last Failure

    Expand for error
     The sample did not exit in 600000ms. Memory dump taken: True. Killing process.
    
  • EarlyFlakeDetection - Datadog.Trace.ClrProfiler.IntegrationTests.CI.UdsXUnitEvpTests - Last Failure

    Expand for error
     The sample did not exit in 600000ms. Memory dump taken: True. Killing process.
    
  • HandleProduceAndConsume - Datadog.Trace.ClrProfiler.IntegrationTests.DataStreamsMonitoringRabbitMQTests - Last Failure

    Expand for error
     Results do not match.
     Differences:
     Received: DataStreamsMonitoringRabbitMQTests.HandleProduceAndConsume.received.txt
     Verified: DataStreamsMonitoringRabbitMQTests.HandleProduceAndConsume.verified.txt
     Received Content:
     [
       {
         EdgeTags: [
           direction:in,
           topic:TopicQueue2,
     ...
    

@andrewlock
Copy link
Member

andrewlock commented Jan 2, 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 (6495) - mean (68ms)  : 66, 71
     .   : milestone, 68,
    master - mean (69ms)  : 65, 73
     .   : milestone, 69,

    section CallTarget+Inlining+NGEN
    This PR (6495) - mean (975ms)  : 955, 994
     .   : milestone, 975,
    master - mean (980ms)  : 953, 1007
     .   : milestone, 980,

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

    section CallTarget+Inlining+NGEN
    This PR (6495) - mean (676ms)  : 662, 691
     .   : milestone, 676,
    master - mean (678ms)  : 661, 695
     .   : milestone, 678,

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

    section CallTarget+Inlining+NGEN
    This PR (6495) - mean (630ms)  : 613, 647
     .   : milestone, 630,
    master - mean (633ms)  : 614, 653
     .   : milestone, 633,

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

    section CallTarget+Inlining+NGEN
    This PR (6495) - mean (1,101ms)  : 1072, 1131
     .   : milestone, 1101,
    master - mean (1,099ms)  : 1071, 1126
     .   : milestone, 1099,

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

    section CallTarget+Inlining+NGEN
    This PR (6495) - mean (866ms)  : 844, 888
     .   : milestone, 866,
    master - mean (871ms)  : 839, 903
     .   : milestone, 871,

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

    section CallTarget+Inlining+NGEN
    This PR (6495) - mean (845ms)  : 818, 872
     .   : milestone, 845,
    master - mean (852ms)  : 817, 887
     .   : milestone, 852,

Loading

@andrewlock
Copy link
Member

andrewlock commented Jan 2, 2025

Benchmarks Report for appsec 🐌

Benchmarks for #6495 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.175
  • 1 benchmarks are slower, with geometric mean 1.133
  • 1 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.Asm.AppSecBodyBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6495

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody‑net6.0 1.133 190,150.78 215,520.70

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 185μs 97.4ns 365ns 2.69 0 0 188.9 KB
master AllCycleSimpleBody netcoreapp3.1 284μs 106ns 396ns 2.69 0 0 196.23 KB
master AllCycleSimpleBody net472 249μs 347ns 1.35μs 35.9 1.99 0 225.95 KB
master AllCycleMoreComplexBody net6.0 190μs 93.5ns 350ns 2.66 0 0 192.41 KB
master AllCycleMoreComplexBody netcoreapp3.1 290μs 146ns 545ns 2.6 0 0 199.65 KB
master AllCycleMoreComplexBody net472 255μs 174ns 627ns 36.4 2.04 0 229.46 KB
master ObjectExtractorSimpleBody net6.0 138ns 0.0524ns 0.196ns 0.00396 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 190ns 0.153ns 0.573ns 0.00377 0 0 272 B
master ObjectExtractorSimpleBody net472 163ns 0.155ns 0.599ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 2.91μs 1.81ns 6.77ns 0.0535 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 3.88μs 1.72ns 6.19ns 0.0506 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 3.61μs 3.68ns 13.8ns 0.602 0.00539 0 3.8 KB
#6495 AllCycleSimpleBody net6.0 205μs 140ns 504ns 2.57 0 0 188.76 KB
#6495 AllCycleSimpleBody netcoreapp3.1 306μs 96.3ns 360ns 2.59 0 0 196.09 KB
#6495 AllCycleSimpleBody net472 271μs 143ns 552ns 35.8 2.03 0 225.79 KB
#6495 AllCycleMoreComplexBody net6.0 216μs 87.4ns 315ns 2.69 0 0 192.26 KB
#6495 AllCycleMoreComplexBody netcoreapp3.1 309μs 113ns 423ns 2.78 0 0 199.51 KB
#6495 AllCycleMoreComplexBody net472 272μs 93.8ns 351ns 36.4 2.06 0 229.3 KB
#6495 ObjectExtractorSimpleBody net6.0 139ns 0.162ns 0.629ns 0.00394 0 0 280 B
#6495 ObjectExtractorSimpleBody netcoreapp3.1 193ns 0.0997ns 0.359ns 0.00369 0 0 272 B
#6495 ObjectExtractorSimpleBody net472 167ns 0.13ns 0.486ns 0.0446 0 0 281 B
#6495 ObjectExtractorMoreComplexBody net6.0 2.92μs 1.45ns 5.41ns 0.0537 0 0 3.78 KB
#6495 ObjectExtractorMoreComplexBody netcoreapp3.1 3.87μs 1.68ns 6.5ns 0.0506 0 0 3.69 KB
#6495 ObjectExtractorMoreComplexBody net472 3.59μs 3.02ns 11.7ns 0.603 0.00542 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 17.5ns 67.8ns 0.457 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 53.9μs 22.6ns 87.5ns 0.428 0 0 32.4 KB
master EncodeArgs net472 66.1μs 51.1ns 198ns 5.16 0.0666 0 32.5 KB
master EncodeLegacyArgs net6.0 76μs 57.4ns 222ns 0 0 0 2.14 KB
master EncodeLegacyArgs netcoreapp3.1 107μs 312ns 1.21μs 0 0 0 2.14 KB
master EncodeLegacyArgs net472 155μs 79ns 306ns 0.312 0 0 2.15 KB
#6495 EncodeArgs net6.0 36.4μs 16.7ns 64.9ns 0.455 0 0 32.4 KB
#6495 EncodeArgs netcoreapp3.1 54.7μs 25.1ns 93.7ns 0.44 0 0 32.4 KB
#6495 EncodeArgs net472 66.9μs 50.4ns 195ns 5.16 0.0666 0 32.5 KB
#6495 EncodeLegacyArgs net6.0 75.4μs 11.5ns 41.4ns 0 0 0 2.14 KB
#6495 EncodeLegacyArgs netcoreapp3.1 107μs 33.5ns 130ns 0 0 0 2.14 KB
#6495 EncodeLegacyArgs net472 157μs 146ns 565ns 0.314 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 174μs 71.6ns 277ns 0 0 0 2.44 KB
master RunWafRealisticBenchmark netcoreapp3.1 187μs 154ns 596ns 0 0 0 2.39 KB
master RunWafRealisticBenchmark net472 200μs 112ns 433ns 0.3 0 0 2.46 KB
master RunWafRealisticBenchmarkWithAttack net6.0 116μs 210ns 814ns 0 0 0 1.47 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 125μs 135ns 524ns 0 0 0 1.46 KB
master RunWafRealisticBenchmarkWithAttack net472 133μs 50.8ns 197ns 0.2 0 0 1.49 KB
#6495 RunWafRealisticBenchmark net6.0 176μs 202ns 781ns 0 0 0 2.44 KB
#6495 RunWafRealisticBenchmark netcoreapp3.1 185μs 128ns 495ns 0 0 0 2.39 KB
#6495 RunWafRealisticBenchmark net472 200μs 110ns 427ns 0.299 0 0 2.46 KB
#6495 RunWafRealisticBenchmarkWithAttack net6.0 116μs 179ns 693ns 0 0 0 1.47 KB
#6495 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 123μs 94.2ns 353ns 0 0 0 1.46 KB
#6495 RunWafRealisticBenchmarkWithAttack net472 134μs 149ns 577ns 0.199 0 0 1.49 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Faster 🎉 More allocations ⚠️

Faster 🎉 in #6495

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 1.175 63,350.00 53,900.00 multimodal

More allocations ⚠️ in #6495

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 255.4 KB 265.1 KB 9.7 KB 3.80%

Fewer allocations 🎉 in #6495

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 256.22 KB 254.44 KB -1.78 KB -0.70%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 59.9μs 762ns 7.59μs 0 0 0 43.44 KB
master StringConcatBenchmark netcoreapp3.1 62.8μs 780ns 7.72μs 0 0 0 42.64 KB
master StringConcatBenchmark net472 36.9μs 64.6ns 233ns 0 0 0 59.12 KB
master StringConcatAspectBenchmark net6.0 332μs 1.81μs 9.9μs 0 0 0 255.4 KB
master StringConcatAspectBenchmark netcoreapp3.1 346μs 1.72μs 11μs 0 0 0 256.22 KB
master StringConcatAspectBenchmark net472 275μs 5.59μs 52.7μs 0 0 0 278.53 KB
#6495 StringConcatBenchmark net6.0 61.6μs 705ns 6.83μs 0 0 0 43.44 KB
#6495 StringConcatBenchmark netcoreapp3.1 53.6μs 248ns 992ns 0 0 0 42.64 KB
#6495 StringConcatBenchmark net472 37.4μs 65.3ns 226ns 0 0 0 59.04 KB
#6495 StringConcatAspectBenchmark net6.0 324μs 1.69μs 12.7μs 0 0 0 265.1 KB
#6495 StringConcatAspectBenchmark netcoreapp3.1 353μs 1.97μs 12.8μs 0 0 0 254.44 KB
#6495 StringConcatAspectBenchmark net472 289μs 6.62μs 65.2μs 0 0 0 278.53 KB

@e-n-0 e-n-0 marked this pull request as ready for review January 2, 2025 15:42
@e-n-0 e-n-0 requested review from a team as code owners January 2, 2025 15:42
@@ -865,6 +866,16 @@ internal static void OnEmailHtmlInjection(object? message)
GetScope(messageDuck.Body, IntegrationId.EmailHtmlInjection, VulnerabilityTypeName.EmailHtmlInjection, OperationNameEmailHtmlInjection, taintValidator: Always, safeSources: _dbSources, exclusionSecureMarks: SecureMarks.Xss);
}

public static void LogAspectException(Exception ex, string message)
{
if (!LoggedAspectExceptionMessages.Add(message.GetHashCode()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 👍

{
if (!LoggedAspectExceptionMessages.Add(message.GetHashCode()))
{
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we could trace as debug level

Copy link
Contributor

Choose a reason for hiding this comment

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

This function should be try catched also

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed in e609bbb and eb9d9b8 😄

@andrewlock
Copy link
Member

andrewlock commented Jan 2, 2025

Benchmarks Report for tracer 🐌

Benchmarks for #6495 compared to master:

  • 3 benchmarks are slower, with geometric mean 1.175
  • 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.3μs 47.3ns 335ns 0.0193 0.00773 0 5.61 KB
master StartStopWithChild netcoreapp3.1 10.2μs 55.2ns 292ns 0.0154 0.00514 0 5.8 KB
master StartStopWithChild net472 16.6μs 65.3ns 253ns 1.04 0.296 0.0905 6.22 KB
#6495 StartStopWithChild net6.0 8μs 44.7ns 307ns 0.0125 0.00416 0 5.61 KB
#6495 StartStopWithChild netcoreapp3.1 10μs 52.7ns 253ns 0.0142 0.00475 0 5.8 KB
#6495 StartStopWithChild net472 16.4μs 46.2ns 179ns 1.03 0.296 0.088 6.22 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 409ns 1.58μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 688μs 233ns 873ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 857μs 484ns 1.81μs 0.431 0 0 3.3 KB
#6495 WriteAndFlushEnrichedTraces net6.0 484μs 193ns 748ns 0 0 0 2.7 KB
#6495 WriteAndFlushEnrichedTraces netcoreapp3.1 650μs 536ns 2.08μs 0 0 0 2.7 KB
#6495 WriteAndFlushEnrichedTraces net472 852μs 379ns 1.42μs 0.425 0 0 3.3 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 154μs 935ns 9.25μs 0.168 0 0 14.47 KB
master SendRequest netcoreapp3.1 186μs 1.78μs 17.7μs 0.175 0 0 17.27 KB
master SendRequest net472 0.00291ns 0.00119ns 0.00462ns 0 0 0 0 b
#6495 SendRequest net6.0 150μs 813ns 5.27μs 0.157 0 0 14.47 KB
#6495 SendRequest netcoreapp3.1 173μs 1.02μs 9.48μs 0.172 0 0 17.27 KB
#6495 SendRequest net472 0.00154ns 0.000907ns 0.00351ns 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 587μs 3.32μs 21.8μs 0.291 0 0 41.66 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 672μs 3.63μs 19.5μs 0.388 0 0 41.81 KB
master WriteAndFlushEnrichedTraces net472 834μs 3.96μs 15.3μs 8.45 2.53 0.422 53.28 KB
#6495 WriteAndFlushEnrichedTraces net6.0 567μs 3.14μs 19.3μs 0.543 0 0 41.68 KB
#6495 WriteAndFlushEnrichedTraces netcoreapp3.1 665μs 3.53μs 17.7μs 0.336 0 0 41.62 KB
#6495 WriteAndFlushEnrichedTraces net472 841μs 4.06μs 17.2μs 8.08 2.55 0.425 53.29 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.3μs 1.36ns 5.28ns 0.0144 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.71μs 2.06ns 7.71ns 0.0133 0 0 1.02 KB
master ExecuteNonQuery net472 2.1μs 2.58ns 10ns 0.156 0.00106 0 987 B
#6495 ExecuteNonQuery net6.0 1.26μs 1.16ns 4.47ns 0.0145 0 0 1.02 KB
#6495 ExecuteNonQuery netcoreapp3.1 1.84μs 2.96ns 11.4ns 0.0136 0 0 1.02 KB
#6495 ExecuteNonQuery net472 2.06μs 3.19ns 12.3ns 0.156 0.00102 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.3μs 1.81ns 6.77ns 0.0134 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.52μs 2.42ns 9.36ns 0.013 0 0 976 B
master CallElasticsearch net472 2.47μs 1.18ns 4.43ns 0.158 0 0 995 B
master CallElasticsearchAsync net6.0 1.3μs 0.441ns 1.65ns 0.013 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.6μs 0.577ns 2.16ns 0.0136 0 0 1.02 KB
master CallElasticsearchAsync net472 2.6μs 0.815ns 2.82ns 0.167 0 0 1.05 KB
#6495 CallElasticsearch net6.0 1.38μs 0.754ns 2.82ns 0.0137 0 0 976 B
#6495 CallElasticsearch netcoreapp3.1 1.56μs 0.775ns 2.9ns 0.0131 0 0 976 B
#6495 CallElasticsearch net472 2.49μs 2.32ns 8.98ns 0.157 0 0 995 B
#6495 CallElasticsearchAsync net6.0 1.35μs 1.06ns 4.11ns 0.0128 0 0 952 B
#6495 CallElasticsearchAsync netcoreapp3.1 1.74μs 0.565ns 2.19ns 0.0139 0 0 1.02 KB
#6495 CallElasticsearchAsync net472 2.77μs 2.53ns 9.81ns 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.37μs 0.395ns 1.42ns 0.013 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.65μs 0.859ns 3.33ns 0.0124 0 0 952 B
master ExecuteAsync net472 1.82μs 0.896ns 3.47ns 0.145 0 0 915 B
#6495 ExecuteAsync net6.0 1.4μs 1.18ns 4.4ns 0.0133 0 0 952 B
#6495 ExecuteAsync netcoreapp3.1 1.62μs 1.95ns 7.28ns 0.0122 0 0 952 B
#6495 ExecuteAsync net472 1.91μs 0.548ns 2.05ns 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 1.65ns 6.37ns 0.0314 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.4μs 1.84ns 7.13ns 0.0379 0 0 2.85 KB
master SendAsync net472 7.61μs 1.62ns 6.29ns 0.493 0 0 3.12 KB
#6495 SendAsync net6.0 4.39μs 1.28ns 4.8ns 0.033 0 0 2.31 KB
#6495 SendAsync netcoreapp3.1 5.31μs 2.2ns 8.23ns 0.0372 0 0 2.85 KB
#6495 SendAsync net472 7.43μs 2.89ns 11.2ns 0.492 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.48μs 0.708ns 2.65ns 0.0229 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.2μs 1.25ns 4.69ns 0.022 0 0 1.64 KB
master EnrichedLog net472 2.65μs 2.56ns 9.93ns 0.249 0 0 1.57 KB
#6495 EnrichedLog net6.0 1.46μs 1ns 3.89ns 0.0227 0 0 1.64 KB
#6495 EnrichedLog netcoreapp3.1 2.22μs 1.65ns 6.38ns 0.0221 0 0 1.64 KB
#6495 EnrichedLog net472 2.76μs 2.48ns 9.28ns 0.248 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 135ns 525ns 0.059 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 121μs 157ns 607ns 0 0 0 4.28 KB
master EnrichedLog net472 150μs 114ns 426ns 0.677 0.226 0 4.46 KB
#6495 EnrichedLog net6.0 117μs 92.7ns 359ns 0.0585 0 0 4.28 KB
#6495 EnrichedLog netcoreapp3.1 122μs 193ns 747ns 0 0 0 4.28 KB
#6495 EnrichedLog net472 153μs 145ns 563ns 0.69 0.23 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.91μs 0.908ns 3.52ns 0.0306 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.36μs 2.3ns 8.61ns 0.0284 0 0 2.2 KB
master EnrichedLog net472 4.86μs 1.99ns 7.69ns 0.321 0 0 2.02 KB
#6495 EnrichedLog net6.0 2.97μs 1.2ns 4.48ns 0.0297 0 0 2.2 KB
#6495 EnrichedLog netcoreapp3.1 4.29μs 1.95ns 7.54ns 0.0279 0 0 2.2 KB
#6495 EnrichedLog net472 4.9μs 1.69ns 6.1ns 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.41μs 0.66ns 2.56ns 0.0162 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.73μs 0.74ns 2.86ns 0.0156 0 0 1.14 KB
master SendReceive net472 2.09μs 0.989ns 3.83ns 0.184 0 0 1.16 KB
#6495 SendReceive net6.0 1.51μs 1.07ns 4.15ns 0.0158 0 0 1.14 KB
#6495 SendReceive netcoreapp3.1 1.89μs 1.19ns 4.59ns 0.0152 0 0 1.14 KB
#6495 SendReceive net472 2.1μs 1.45ns 5.44ns 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.67μs 0.721ns 2.79ns 0.0227 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.84μs 0.924ns 3.2ns 0.0211 0 0 1.65 KB
master EnrichedLog net472 4.39μs 1.53ns 5.71ns 0.323 0 0 2.04 KB
#6495 EnrichedLog net6.0 2.78μs 1.2ns 4.48ns 0.0222 0 0 1.6 KB
#6495 EnrichedLog netcoreapp3.1 3.88μs 1.41ns 5.45ns 0.0216 0 0 1.65 KB
#6495 EnrichedLog net472 4.32μs 3.39ns 12.7ns 0.322 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6495

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 1.200 481.21 577.28
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 1.156 398.49 460.45

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 399ns 0.229ns 0.887ns 0.00804 0 0 576 B
master StartFinishSpan netcoreapp3.1 610ns 0.455ns 1.7ns 0.00768 0 0 576 B
master StartFinishSpan net472 742ns 0.301ns 1.17ns 0.0915 0 0 578 B
master StartFinishScope net6.0 481ns 0.279ns 1.08ns 0.00991 0 0 696 B
master StartFinishScope netcoreapp3.1 808ns 0.536ns 2.08ns 0.00929 0 0 696 B
master StartFinishScope net472 961ns 0.532ns 2.06ns 0.104 0 0 658 B
#6495 StartFinishSpan net6.0 460ns 0.261ns 0.977ns 0.0081 0 0 576 B
#6495 StartFinishSpan netcoreapp3.1 561ns 0.601ns 2.25ns 0.0075 0 0 576 B
#6495 StartFinishSpan net472 723ns 0.424ns 1.64ns 0.0916 0 0 578 B
#6495 StartFinishScope net6.0 577ns 0.45ns 1.74ns 0.0098 0 0 696 B
#6495 StartFinishScope netcoreapp3.1 802ns 1.71ns 6.61ns 0.00945 0 0 696 B
#6495 StartFinishScope net472 872ns 0.581ns 2.25ns 0.104 0 0 658 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6495

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑netcoreapp3.1 1.170 857.63 1,003.31

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 588ns 0.358ns 1.38ns 0.00986 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 858ns 0.299ns 1.12ns 0.00947 0 0 696 B
master RunOnMethodBegin net472 1.14μs 0.509ns 1.97ns 0.104 0 0 658 B
#6495 RunOnMethodBegin net6.0 627ns 0.243ns 0.91ns 0.00977 0 0 696 B
#6495 RunOnMethodBegin netcoreapp3.1 1μs 1.29ns 5.01ns 0.00958 0 0 696 B
#6495 RunOnMethodBegin net472 1.13μs 0.547ns 2.12ns 0.104 0 0 658 B

@e-n-0 e-n-0 requested a review from daniel-romano-DD January 3, 2025 14:23
Copy link
Contributor

@daniel-romano-DD daniel-romano-DD left a comment

Choose a reason for hiding this comment

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

Thanks a lot

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.

I think you'll need to tweak the logging code a little, but otherwise LGTM I think!

tracer/src/Datadog.Trace/Iast/IastModule.cs Outdated Show resolved Hide resolved
tracer/src/Datadog.Trace/Iast/IastModule.cs Outdated Show resolved Hide resolved
@e-n-0 e-n-0 requested a review from andrewlock January 3, 2025 15:11
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, thanks!

@andrewlock
Copy link
Member

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 (6495) (11.123M)   : 0, 11123451
    master (11.258M)   : 0, 11257571
    benchmarks/2.9.0 (11.160M)   : 0, 11159702

    section Automatic
    This PR (6495) (7.239M)   : 0, 7239215
    master (7.252M)   : 0, 7252228
    benchmarks/2.9.0 (7.903M)   : 0, 7903236

    section Trace stats
    master (7.548M)   : 0, 7547701

    section Manual
    master (11.069M)   : 0, 11068719

    section Manual + Automatic
    This PR (6495) (6.642M)   : 0, 6641739
    master (6.704M)   : 0, 6703812

    section DD_TRACE_ENABLED=0
    master (10.285M)   : 0, 10285063

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6495) (9.550M)   : 0, 9550163
    master (9.595M)   : 0, 9595067

    section Automatic
    This PR (6495) (6.420M)   : 0, 6420313
    master (6.426M)   : 0, 6426459

    section Trace stats
    master (6.647M)   : 0, 6647290

    section Manual
    master (9.350M)   : 0, 9349758

    section Manual + Automatic
    This PR (6495) (6.041M)   : 0, 6040563
    master (6.007M)   : 0, 6007487

    section DD_TRACE_ENABLED=0
    master (8.892M)   : 0, 8891747

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6495) (10.208M)   : 0, 10208209
    benchmarks/2.9.0 (10.114M)   : 0, 10114374

    section Automatic
    This PR (6495) (6.736M)   : 0, 6736202
    benchmarks/2.9.0 (7.468M)   : 0, 7467741

    section Manual + Automatic
    This PR (6495) (6.284M)   : 0, 6284205

Loading

@e-n-0 e-n-0 merged commit 9194a87 into master Jan 4, 2025
103 checks passed
@e-n-0 e-n-0 deleted the flavien/iast-aspects-logging branch January 4, 2025 13:13
@github-actions github-actions bot added this to the vNext-v3 milestone Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants