-
Notifications
You must be signed in to change notification settings - Fork 143
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
AspectsGenerator refactor #5078
Conversation
tracer/src/Datadog.Trace.SourceGenerators/AspectsDefinitions/AspectsDefinitionsGenerator.cs
Outdated
Show resolved
Hide resolved
// Process InstrumentMethodAttribute first | ||
foreach (AttributeData attributeData in boundAttributes) | ||
if (attribute.AttributeClass is null) { continue; } | ||
if (attribute.AttributeClass.Name == "AspectClassAttribute") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to use the full type name to be safe (though in reality, it almost certainly won't be a problem!)
dd-trace-dotnet/tracer/src/Datadog.Trace.SourceGenerators/EnumExtensions/EnumExtensionsGenerator.cs
Lines 76 to 78 in 40a49fb
if ((attributeData.AttributeClass?.Name == "FlagsAttribute" || | |
attributeData.AttributeClass?.Name == "Flags") && | |
attributeData.AttributeClass.ToDisplayString() == FlagsAttribute) |
tracer/src/Datadog.Trace.SourceGenerators/AspectsDefinitions/AspectsDefinitionsGenerator.cs
Outdated
Show resolved
Hide resolved
tracer/src/Datadog.Trace/Iast/Aspects/System.DirectoryServices/DirectoryEntryAspect.cs
Outdated
Show resolved
Hide resolved
… in the ClassAspect, instead of "Propagation" (bug fix)
90f6d7a
to
cb41312
Compare
Datadog ReportBranch report: ✅ 0 Failed, 306530 Passed, 1506 Skipped, 57m 22.05s Wall Time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! 👍
new DiagnosticDescriptor( | ||
"AG1", | ||
"AspectsGenerator Error", | ||
"Error message", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "Error Message"
really the correct string 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I'm not issuing diagnostics by now. It's a placeholder for later
<ItemGroup> | ||
<Folder Include="AspectsDefinitions\Sources\" /> | ||
</ItemGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed I think
<ItemGroup> | |
<Folder Include="AspectsDefinitions\Sources\" /> | |
</ItemGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is If I want to add the sources to compilation on the fly. Something left for next improvement
" [AspectMethodInsertBefore(\"System.Net.WebClient::UploadValues(System.String,System.String,System.Collections.Specialized.NameValueCollection)\",\"\",[2],[False],[None],Propagation,[])] Review(System.String)", | ||
" [AspectMethodInsertBefore(\"System.Net.WebClient::UploadValuesTaskAsync(System.String,System.Collections.Specialized.NameValueCollection)\",\"\",[1],[False],[None],Propagation,[])] Review(System.String)", | ||
" [AspectMethodInsertBefore(\"System.Net.WebClient::UploadValuesTaskAsync(System.String,System.String,System.Collections.Specialized.NameValueCollection)\",\"\",[2],[False],[None],Propagation,[])] Review(System.String)", | ||
" [AspectMethodInsertBefore(\"System.Net.WebClient::set_BaseAddress(System.String)\",\"\",[0],[False],[None],Propagation,[])] Review(System.String)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume all the Propagation
-> Default
is intentional, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's Default
. It was a pending bug we had to fix (it is usage metadata)
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:
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 (5078) - mean (72ms) : 64, 81
. : milestone, 72,
master - mean (73ms) : 63, 84
. : milestone, 73,
section CallTarget+Inlining+NGEN
This PR (5078) - mean (961ms) : 933, 990
. : milestone, 961,
master - mean (1,028ms) : 1003, 1053
. : milestone, 1028,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5078) - mean (107ms) : 103, 111
. : milestone, 107,
master - mean (106ms) : 102, 110
. : milestone, 106,
section CallTarget+Inlining+NGEN
This PR (5078) - mean (702ms) : 683, 720
. : milestone, 702,
master - mean (731ms) : 714, 748
. : milestone, 731,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5078) - mean (91ms) : 88, 94
. : milestone, 91,
master - mean (90ms) : 87, 93
. : milestone, 90,
section CallTarget+Inlining+NGEN
This PR (5078) - mean (662ms) : 643, 681
. : milestone, 662,
master - mean (693ms) : 669, 716
. : milestone, 693,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5078) - mean (189ms) : 186, 191
. : milestone, 189,
master - mean (189ms) : 185, 192
. : milestone, 189,
section CallTarget+Inlining+NGEN
This PR (5078) - mean (1,072ms) : 1045, 1098
. : milestone, 1072,
master - mean (1,135ms) : 1117, 1154
. : milestone, 1135,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5078) - mean (273ms) : 269, 277
. : milestone, 273,
master - mean (272ms) : 267, 277
. : milestone, 272,
section CallTarget+Inlining+NGEN
This PR (5078) - mean (1,051ms) : 1027, 1075
. : milestone, 1051,
master - mean (1,086ms) : 1064, 1109
. : milestone, 1086,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (5078) - mean (261ms) : 257, 265
. : milestone, 261,
master - mean (261ms) : 258, 265
. : milestone, 261,
section CallTarget+Inlining+NGEN
This PR (5078) - mean (1,013ms) : 992, 1033
. : milestone, 1013,
master - mean (1,053ms) : 1033, 1073
. : milestone, 1053,
|
Throughput/Crank Report:zap: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 (5078) (11.689M) : 0, 11689433
master (11.793M) : 0, 11792846
benchmarks/2.9.0 (11.757M) : 0, 11756801
section Automatic
This PR (5078) (8.011M) : 0, 8010946
master (8.076M) : 0, 8076448
benchmarks/2.9.0 (8.573M) : 0, 8573327
section Trace stats
This PR (5078) (8.374M) : 0, 8373553
master (8.407M) : 0, 8406782
section Manual
This PR (5078) (10.293M) : 0, 10293117
master (10.353M) : 0, 10352820
section Manual + Automatic
This PR (5078) (7.527M) : 0, 7527013
master (7.610M) : 0, 7610023
section Version Conflict
This PR (5078) (6.846M) : 0, 6845758
master (6.845M) : 0, 6845162
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (5078) (9.641M) : 0, 9641178
master (9.498M) : 0, 9497633
benchmarks/2.9.0 (9.605M) : 0, 9605360
section Automatic
This PR (5078) (6.663M) : 0, 6662812
master (6.538M) : 0, 6538176
section Trace stats
This PR (5078) (7.008M) : 0, 7008071
master (6.967M) : 0, 6966769
section Manual
This PR (5078) (8.103M) : 0, 8102983
master (8.183M) : 0, 8183082
section Manual + Automatic
This PR (5078) (6.165M) : 0, 6165256
master (6.155M) : 0, 6155194
section Version Conflict
This PR (5078) (5.698M) : 0, 5698037
master (5.582M) : 0, 5581839
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (5078) (10.125M) : 0, 10125368
master (10.290M) : 0, 10289786
benchmarks/2.9.0 (9.956M) : 0, 9956027
section Automatic
This PR (5078) (7.116M) : 0, 7115993
master (7.052M) : 0, 7051599
benchmarks/2.9.0 (7.438M) : 0, 7437608
section Trace stats
This PR (5078) (7.530M) : 0, 7529843
master (7.398M) : 0, 7397958
section Manual
This PR (5078) (8.803M) : 0, 8802741
master (8.955M) : 0, 8954877
section Manual + Automatic
This PR (5078) (6.842M) : 0, 6841876
master (6.754M) : 0, 6754356
section Version Conflict
This PR (5078) (6.282M) : 0, 6282007
master (6.121M) : 0, 6120614
gantt
title Throughput Linux x64 (ASM) (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (5078) (7.507M) : 0, 7506914
master (7.304M) : 0, 7303586
benchmarks/2.9.0 (7.813M) : 0, 7813475
section No attack
This PR (5078) (1.762M) : 0, 1762427
master (1.762M) : 0, 1762048
benchmarks/2.9.0 (3.251M) : 0, 3251456
section Attack
This PR (5078) (1.421M) : 0, 1421175
master (1.413M) : 0, 1413289
benchmarks/2.9.0 (2.577M) : 0, 2577462
section Blocking
This PR (5078) (3.146M) : 0, 3145994
master (3.108M) : 0, 3107757
section IAST default
This PR (5078) (6.556M) : 0, 6555696
master (6.434M) : 0, 6433540
section IAST full
This PR (5078) (5.543M) : 0, 5543276
master (5.532M) : 0, 5532224
section Base vuln
This PR (5078) (0.939M) : 0, 938653
master (0.929M) : 0, 928748
section IAST vuln
This PR (5078) (0.845M) : crit ,0, 845416
master (0.890M) : 0, 890135
|
Benchmarks Report 🐌Benchmarks for #5078 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations
|
Benchmark | Base Allocated | Diff Allocated | Change | Change % |
---|---|---|---|---|
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 | 41.71 KB | 41.96 KB | 247 B | 0.59% |
Benchmark | Base Allocated | Diff Allocated | Change | Change % |
---|---|---|---|---|
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 | 41.85 KB | 41.46 KB | -391 B | -0.93% |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | WriteAndFlushEnrichedTraces |
net6.0 | 547μs | 1μs | 3.88μs | 0.534 | 0 | 0 | 41.85 KB |
master | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 657μs | 951ns | 3.68μs | 0.334 | 0 | 0 | 41.71 KB |
master | WriteAndFlushEnrichedTraces |
net472 | 839μs | 2.91μs | 11.3μs | 8.28 | 2.48 | 0.414 | 53.25 KB |
#5078 | WriteAndFlushEnrichedTraces |
net6.0 | 558μs | 177ns | 615ns | 0.563 | 0 | 0 | 41.46 KB |
#5078 | WriteAndFlushEnrichedTraces |
netcoreapp3.1 | 652μs | 1.51μs | 5.83μs | 0.329 | 0 | 0 | 41.96 KB |
#5078 | WriteAndFlushEnrichedTraces |
net472 | 854μs | 4.05μs | 17.2μs | 8.13 | 2.57 | 0.428 | 53.24 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.05μs | 0.274ns | 0.988ns | 0.0106 | 0 | 0 | 768 B |
master | ExecuteNonQuery |
netcoreapp3.1 | 1.47μs | 0.732ns | 2.83ns | 0.0103 | 0 | 0 | 768 B |
master | ExecuteNonQuery |
net472 | 1.8μs | 0.71ns | 2.56ns | 0.116 | 0 | 0 | 730 B |
#5078 | ExecuteNonQuery |
net6.0 | 1.09μs | 0.29ns | 1.08ns | 0.0104 | 0 | 0 | 768 B |
#5078 | ExecuteNonQuery |
netcoreapp3.1 | 1.45μs | 0.716ns | 2.77ns | 0.0101 | 0 | 0 | 768 B |
#5078 | ExecuteNonQuery |
net472 | 1.81μs | 1.72ns | 6.43ns | 0.115 | 0 | 0 | 730 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.21μs | 1.18ns | 4.56ns | 0.013 | 0 | 0 | 936 B |
master | CallElasticsearch |
netcoreapp3.1 | 1.56μs | 1.72ns | 6.45ns | 0.0126 | 0 | 0 | 936 B |
master | CallElasticsearch |
net472 | 2.5μs | 0.735ns | 2.85ns | 0.151 | 0 | 0 | 955 B |
master | CallElasticsearchAsync |
net6.0 | 1.3μs | 0.558ns | 2.16ns | 0.0124 | 0 | 0 | 912 B |
master | CallElasticsearchAsync |
netcoreapp3.1 | 1.54μs | 0.486ns | 1.88ns | 0.0131 | 0 | 0 | 984 B |
master | CallElasticsearchAsync |
net472 | 2.77μs | 1.15ns | 4.44ns | 0.16 | 0 | 0 | 1.01 KB |
#5078 | CallElasticsearch |
net6.0 | 1.25μs | 2.74ns | 10.6ns | 0.013 | 0 | 0 | 936 B |
#5078 | CallElasticsearch |
netcoreapp3.1 | 1.53μs | 1.62ns | 6.08ns | 0.0129 | 0 | 0 | 936 B |
#5078 | CallElasticsearch |
net472 | 2.49μs | 1.3ns | 5.02ns | 0.151 | 0 | 0 | 955 B |
#5078 | CallElasticsearchAsync |
net6.0 | 1.29μs | 0.691ns | 2.58ns | 0.0129 | 0 | 0 | 912 B |
#5078 | CallElasticsearchAsync |
netcoreapp3.1 | 1.69μs | 0.593ns | 2.22ns | 0.0128 | 0 | 0 | 984 B |
#5078 | CallElasticsearchAsync |
net472 | 2.56μs | 0.862ns | 3.34ns | 0.16 | 0 | 0 | 1.01 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.48μs | 0.646ns | 2.24ns | 0.0126 | 0 | 0 | 912 B |
master | ExecuteAsync |
netcoreapp3.1 | 1.66μs | 1.43ns | 5.35ns | 0.0124 | 0 | 0 | 912 B |
master | ExecuteAsync |
net472 | 1.83μs | 0.483ns | 1.81ns | 0.139 | 0 | 0 | 875 B |
#5078 | ExecuteAsync |
net6.0 | 1.36μs | 0.892ns | 3.45ns | 0.0129 | 0 | 0 | 912 B |
#5078 | ExecuteAsync |
netcoreapp3.1 | 1.63μs | 1.37ns | 4.95ns | 0.0123 | 0 | 0 | 912 B |
#5078 | ExecuteAsync |
net472 | 1.88μs | 3.08ns | 11.9ns | 0.138 | 0 | 0 | 875 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.29μs | 7.03ns | 25.3ns | 0.0299 | 0 | 0 | 2.1 KB |
master | SendAsync |
netcoreapp3.1 | 5.06μs | 2.05ns | 7.68ns | 0.0354 | 0 | 0 | 2.63 KB |
master | SendAsync |
net472 | 7.8μs | 3ns | 11.6ns | 0.523 | 0 | 0 | 3.31 KB |
#5078 | SendAsync |
net6.0 | 4.3μs | 3.44ns | 12.9ns | 0.0298 | 0 | 0 | 2.1 KB |
#5078 | SendAsync |
netcoreapp3.1 | 5.15μs | 13.2ns | 49.5ns | 0.0347 | 0 | 0 | 2.63 KB |
#5078 | SendAsync |
net472 | 7.71μs | 4.81ns | 18.6ns | 0.522 | 0 | 0 | 3.31 KB |
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ Fewer allocations 🎉
Fewer allocations 🎉 in #5078
Benchmark
Base Allocated
Diff Allocated
Change
Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1
204.27 KB
202.62 KB
-1.65 KB
-0.81%
Benchmark | Base Allocated | Diff Allocated | Change | Change % |
---|---|---|---|---|
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 | 204.27 KB | 202.62 KB | -1.65 KB | -0.81% |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StringConcatBenchmark |
net6.0 | 59μs | 1.16μs | 11.3μs | 0 | 0 | 0 | 43.44 KB |
master | StringConcatBenchmark |
netcoreapp3.1 | 54μs | 244ns | 1.17μs | 0 | 0 | 0 | 42.64 KB |
master | StringConcatBenchmark |
net472 | 37.6μs | 77.7ns | 269ns | 0 | 0 | 0 | 61.93 KB |
master | StringConcatAspectBenchmark |
net6.0 | 276μs | 6.83μs | 66.5μs | 0 | 0 | 0 | 212.85 KB |
master | StringConcatAspectBenchmark |
netcoreapp3.1 | 327μs | 6.37μs | 59.4μs | 0 | 0 | 0 | 204.27 KB |
master | StringConcatAspectBenchmark |
net472 | 223μs | 962ns | 3.47μs | 0 | 0 | 0 | 221.18 KB |
#5078 | StringConcatBenchmark |
net6.0 | 52.3μs | 280ns | 1.46μs | 0 | 0 | 0 | 43.44 KB |
#5078 | StringConcatBenchmark |
netcoreapp3.1 | 63.6μs | 835ns | 8.09μs | 0 | 0 | 0 | 42.64 KB |
#5078 | StringConcatBenchmark |
net472 | 38.1μs | 93.1ns | 336ns | 0 | 0 | 0 | 61.9 KB |
#5078 | StringConcatAspectBenchmark |
net6.0 | 289μs | 7.98μs | 78.1μs | 0 | 0 | 0 | 213.57 KB |
#5078 | StringConcatAspectBenchmark |
netcoreapp3.1 | 293μs | 3.55μs | 32.1μs | 0 | 0 | 0 | 202.62 KB |
#5078 | StringConcatAspectBenchmark |
net472 | 237μs | 2.97μs | 28μs | 0 | 0 | 0 | 221.18 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.59μs | 0.62ns | 2.32ns | 0.0223 | 0 | 0 | 1.57 KB |
master | EnrichedLog |
netcoreapp3.1 | 2.2μs | 1.64ns | 6.14ns | 0.0208 | 0 | 0 | 1.57 KB |
master | EnrichedLog |
net472 | 2.58μs | 1.36ns | 5.26ns | 0.238 | 0 | 0 | 1.5 KB |
#5078 | EnrichedLog |
net6.0 | 1.45μs | 0.525ns | 2.03ns | 0.0224 | 0 | 0 | 1.57 KB |
#5078 | EnrichedLog |
netcoreapp3.1 | 2.21μs | 0.752ns | 2.81ns | 0.0209 | 0 | 0 | 1.57 KB |
#5078 | EnrichedLog |
net472 | 2.65μs | 4.16ns | 16.1ns | 0.237 | 0 | 0 | 1.5 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 | 113μs | 130ns | 487ns | 0.0567 | 0 | 0 | 4.21 KB |
master | EnrichedLog |
netcoreapp3.1 | 119μs | 108ns | 418ns | 0.059 | 0 | 0 | 4.21 KB |
master | EnrichedLog |
net472 | 149μs | 119ns | 447ns | 0.668 | 0.223 | 0 | 4.39 KB |
#5078 | EnrichedLog |
net6.0 | 113μs | 111ns | 431ns | 0.0563 | 0 | 0 | 4.21 KB |
#5078 | EnrichedLog |
netcoreapp3.1 | 119μs | 188ns | 726ns | 0.0585 | 0 | 0 | 4.21 KB |
#5078 | EnrichedLog |
net472 | 148μs | 93.3ns | 349ns | 0.668 | 0.223 | 0 | 4.39 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.99μs | 0.867ns | 3.36ns | 0.0299 | 0 | 0 | 2.13 KB |
master | EnrichedLog |
netcoreapp3.1 | 4.28μs | 3.46ns | 13.4ns | 0.0277 | 0 | 0 | 2.13 KB |
master | EnrichedLog |
net472 | 4.86μs | 2.06ns | 7.98ns | 0.308 | 0 | 0 | 1.95 KB |
#5078 | EnrichedLog |
net6.0 | 3.05μs | 2.08ns | 8.06ns | 0.029 | 0 | 0 | 2.13 KB |
#5078 | EnrichedLog |
netcoreapp3.1 | 4.2μs | 9.22ns | 34.5ns | 0.027 | 0 | 0 | 2.13 KB |
#5078 | EnrichedLog |
net472 | 4.82μs | 2.56ns | 9.59ns | 0.307 | 0 | 0 | 1.95 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.33μs | 0.546ns | 2.04ns | 0.0153 | 0 | 0 | 1.1 KB |
master | SendReceive |
netcoreapp3.1 | 1.69μs | 0.803ns | 3.01ns | 0.0147 | 0 | 0 | 1.1 KB |
master | SendReceive |
net472 | 2.2μs | 3.74ns | 14.5ns | 0.177 | 0 | 0 | 1.12 KB |
#5078 | SendReceive |
net6.0 | 1.37μs | 1.61ns | 6.23ns | 0.0157 | 0 | 0 | 1.1 KB |
#5078 | SendReceive |
netcoreapp3.1 | 1.72μs | 1.07ns | 4.13ns | 0.0145 | 0 | 0 | 1.1 KB |
#5078 | SendReceive |
net472 | 2.12μs | 2.75ns | 10.6ns | 0.176 | 0 | 0 | 1.12 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.72μs | 0.774ns | 2.9ns | 0.0217 | 0 | 0 | 1.53 KB |
master | EnrichedLog |
netcoreapp3.1 | 3.84μs | 1.8ns | 6.47ns | 0.0213 | 0 | 0 | 1.58 KB |
master | EnrichedLog |
net472 | 4.31μs | 1.05ns | 4.05ns | 0.311 | 0 | 0 | 1.97 KB |
#5078 | EnrichedLog |
net6.0 | 2.76μs | 1.01ns | 3.9ns | 0.0209 | 0 | 0 | 1.53 KB |
#5078 | EnrichedLog |
netcoreapp3.1 | 3.87μs | 1.36ns | 5.27ns | 0.0212 | 0 | 0 | 1.58 KB |
#5078 | EnrichedLog |
net472 | 4.37μs | 2.28ns | 8.81ns | 0.311 | 0 | 0 | 1.97 KB |
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #5078
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0
1.192
537.83
641.17
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0
1.181
462.49
546.23
Faster 🎉 in #5078
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1
1.209
753.54
623.27
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 | 1.192 | 537.83 | 641.17 | |
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 | 1.181 | 462.49 | 546.23 |
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 | 1.209 | 753.54 | 623.27 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 462ns | 0.13ns | 0.504ns | 0.00742 | 0 | 0 | 536 B |
master | StartFinishSpan |
netcoreapp3.1 | 753ns | 0.697ns | 2.61ns | 0.00719 | 0 | 0 | 536 B |
master | StartFinishSpan |
net472 | 751ns | 0.758ns | 2.93ns | 0.0854 | 0 | 0 | 538 B |
master | StartFinishScope |
net6.0 | 538ns | 0.121ns | 0.467ns | 0.00905 | 0 | 0 | 656 B |
master | StartFinishScope |
netcoreapp3.1 | 926ns | 0.686ns | 2.66ns | 0.00853 | 0 | 0 | 656 B |
master | StartFinishScope |
net472 | 949ns | 0.37ns | 1.28ns | 0.098 | 0 | 0 | 618 B |
#5078 | StartFinishSpan |
net6.0 | 546ns | 0.153ns | 0.592ns | 0.00738 | 0 | 0 | 536 B |
#5078 | StartFinishSpan |
netcoreapp3.1 | 623ns | 0.512ns | 1.92ns | 0.00729 | 0 | 0 | 536 B |
#5078 | StartFinishSpan |
net472 | 821ns | 3.94ns | 15.3ns | 0.0852 | 0 | 0 | 538 B |
#5078 | StartFinishScope |
net6.0 | 641ns | 0.171ns | 0.642ns | 0.00934 | 0 | 0 | 656 B |
#5078 | StartFinishScope |
netcoreapp3.1 | 890ns | 0.245ns | 0.918ns | 0.00867 | 0 | 0 | 656 B |
#5078 | StartFinishScope |
net472 | 980ns | 0.247ns | 0.957ns | 0.0981 | 0 | 0 | 618 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 | 726ns | 0.26ns | 1.01ns | 0.00903 | 0 | 0 | 656 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 1.01μs | 0.786ns | 2.84ns | 0.00901 | 0 | 0 | 656 B |
master | RunOnMethodBegin |
net472 | 1.11μs | 0.388ns | 1.5ns | 0.098 | 0 | 0 | 618 B |
#5078 | RunOnMethodBegin |
net6.0 | 659ns | 0.183ns | 0.683ns | 0.00922 | 0 | 0 | 656 B |
#5078 | RunOnMethodBegin |
netcoreapp3.1 | 934ns | 0.453ns | 1.75ns | 0.00891 | 0 | 0 | 656 B |
#5078 | RunOnMethodBegin |
net472 | 1.1μs | 0.481ns | 1.8ns | 0.0982 | 0 | 0 | 618 B |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed with @andrewlock , I reviewed the changes in Datadog.Trace
and these seem good. Didn't attempt to review Datadog.Trace.SourceGenerator
.
Summary of changes
Refactor
AspectsGenerator
to implementIIncrementalGenerator
best practices in order to improve IDE performanceReason for change
Improve performance of the generator in IDEs
Implementation details
Followed this guideline (thank you @andrewlock)
Test coverage
Other details