[APM] Exclude windows only definitions from non windows dlls#6270
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Datadog ReportBranch report: ✅ 0 Failed, 10936 Passed, 10 Skipped, 36.72s Total Time |
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 (6270) - mean (69ms) : 66, 72
. : milestone, 69,
master - mean (70ms) : 67, 74
. : milestone, 70,
section CallTarget+Inlining+NGEN
This PR (6270) - mean (980ms) : 955, 1005
. : milestone, 980,
master - mean (1,001ms) : 933, 1069
. : milestone, 1001,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6270) - mean (108ms) : 105, 110
. : milestone, 108,
master - mean (109ms) : 107, 111
. : milestone, 109,
section CallTarget+Inlining+NGEN
This PR (6270) - mean (675ms) : 659, 692
. : milestone, 675,
master - mean (727ms) : 638, 816
. : milestone, 727,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6270) - mean (91ms) : 89, 93
. : milestone, 91,
master - mean (105ms) : 97, 113
. : milestone, 105,
section CallTarget+Inlining+NGEN
This PR (6270) - mean (626ms) : 613, 639
. : milestone, 626,
master - mean (696ms) : 646, 745
. : milestone, 696,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6270) - mean (190ms) : 186, 195
. : milestone, 190,
master - mean (191ms) : 185, 197
. : milestone, 191,
section CallTarget+Inlining+NGEN
This PR (6270) - mean (1,088ms) : 1057, 1120
. : milestone, 1088,
master - mean (1,092ms) : 1062, 1122
. : milestone, 1092,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6270) - mean (275ms) : 271, 279
. : milestone, 275,
master - mean (276ms) : 272, 280
. : milestone, 276,
section CallTarget+Inlining+NGEN
This PR (6270) - mean (866ms) : 837, 894
. : milestone, 866,
master - mean (869ms) : 843, 896
. : milestone, 869,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6270) - mean (266ms) : 261, 271
. : milestone, 266,
master - mean (265ms) : 262, 269
. : milestone, 265,
section CallTarget+Inlining+NGEN
This PR (6270) - mean (843ms) : 813, 873
. : milestone, 843,
master - mean (850ms) : 816, 884
. : milestone, 850,
|
Benchmarks Report for appsec 🐌Benchmarks for #6270 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations
|
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 | 253.95 KB | 265.42 KB | 11.47 KB | 4.52% |
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 | 272.91 KB | 278.53 KB | 5.62 KB | 2.06% |
| Benchmark | Base Allocated | Diff Allocated | Change | Change % |
|---|---|---|---|---|
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 | 255.27 KB | 252.41 KB | -2.86 KB | -1.12% |
| Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 | 60.49 KB | 59.07 KB | -1.42 KB | -2.34% |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StringConcatBenchmark |
net6.0 | 52.9μs | 209ns | 782ns | 0 | 0 | 0 | 43.44 KB |
| master | StringConcatBenchmark |
netcoreapp3.1 | 54.2μs | 287ns | 1.38μs | 0 | 0 | 0 | 42.64 KB |
| master | StringConcatBenchmark |
net472 | 38μs | 165ns | 616ns | 0 | 0 | 0 | 60.49 KB |
| master | StringConcatAspectBenchmark |
net6.0 | 295μs | 4.71μs | 43.7μs | 0 | 0 | 0 | 253.95 KB |
| master | StringConcatAspectBenchmark |
netcoreapp3.1 | 354μs | 1.97μs | 12.1μs | 0 | 0 | 0 | 255.27 KB |
| master | StringConcatAspectBenchmark |
net472 | 278μs | 6.14μs | 58.9μs | 0 | 0 | 0 | 272.91 KB |
| #6270 | StringConcatBenchmark |
net6.0 | 52.7μs | 275ns | 1.29μs | 0 | 0 | 0 | 43.44 KB |
| #6270 | StringConcatBenchmark |
netcoreapp3.1 | 62.4μs | 777ns | 7.65μs | 0 | 0 | 0 | 42.64 KB |
| #6270 | StringConcatBenchmark |
net472 | 37.3μs | 80.7ns | 291ns | 0 | 0 | 0 | 59.07 KB |
| #6270 | StringConcatAspectBenchmark |
net6.0 | 325μs | 1.84μs | 12.2μs | 0 | 0 | 0 | 265.42 KB |
| #6270 | StringConcatAspectBenchmark |
netcoreapp3.1 | 333μs | 1.72μs | 9.75μs | 0 | 0 | 0 | 252.41 KB |
| #6270 | StringConcatAspectBenchmark |
net472 | 243μs | 1.19μs | 5.03μs | 0 | 0 | 0 | 278.53 KB |
Benchmarks Report for tracer 🐌Benchmarks for #6270 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.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower
|
| Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 | 1.219 | 594.18 | 724.33 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunOnMethodBegin |
net6.0 | 594ns | 0.761ns | 2.95ns | 0.00961 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 952ns | 1.56ns | 6.06ns | 0.00949 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
net472 | 1.16μs | 2.5ns | 9.66ns | 0.104 | 0 | 0 | 658 B |
| #6270 | RunOnMethodBegin |
net6.0 | 722ns | 1.66ns | 6.44ns | 0.00972 | 0 | 0 | 696 B |
| #6270 | RunOnMethodBegin |
netcoreapp3.1 | 898ns | 1.39ns | 5.39ns | 0.00947 | 0 | 0 | 696 B |
| #6270 | RunOnMethodBegin |
net472 | 1.14μs | 1.88ns | 7.3ns | 0.104 | 0 | 0 | 658 B |
17bc420 to
2277786
Compare
86827a9 to
6d649a3
Compare
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 (6270) (11.125M) : 0, 11124713
master (11.381M) : 0, 11380797
benchmarks/2.9.0 (11.033M) : 0, 11032866
section Automatic
This PR (6270) (7.403M) : 0, 7403107
master (7.372M) : 0, 7371851
benchmarks/2.9.0 (7.786M) : 0, 7785853
section Trace stats
master (7.651M) : 0, 7651180
section Manual
master (11.409M) : 0, 11409121
section Manual + Automatic
This PR (6270) (6.768M) : 0, 6768396
master (6.820M) : 0, 6819669
section DD_TRACE_ENABLED=0
master (10.284M) : 0, 10284096
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6270) (9.634M) : 0, 9633688
master (9.528M) : 0, 9528332
benchmarks/2.9.0 (9.495M) : 0, 9494821
section Automatic
This PR (6270) (6.383M) : 0, 6383298
master (6.301M) : 0, 6300873
section Trace stats
master (6.689M) : 0, 6689036
section Manual
master (9.357M) : 0, 9356534
section Manual + Automatic
This PR (6270) (5.881M) : 0, 5881447
master (5.894M) : 0, 5894490
section DD_TRACE_ENABLED=0
master (8.921M) : 0, 8920806
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6270) (9.868M) : 0, 9867855
master (9.919M) : 0, 9919361
benchmarks/2.9.0 (10.020M) : 0, 10019592
section Automatic
This PR (6270) (6.280M) : 0, 6280411
master (6.191M) : 0, 6191193
benchmarks/2.9.0 (7.255M) : 0, 7255257
section Trace stats
master (6.913M) : 0, 6912642
section Manual
master (9.741M) : 0, 9741372
section Manual + Automatic
This PR (6270) (5.685M) : 0, 5685093
master (5.793M) : 0, 5793028
section DD_TRACE_ENABLED=0
master (9.131M) : 0, 9130759
|
6d649a3 to
78fe837
Compare
cb9c565 to
fa44bc2
Compare
14e921b to
8c9d6b8
Compare
df76b2f to
d1bb046
Compare
239b853 to
2d3d5f9
Compare
d1bb046 to
b0d7fec
Compare
2d3d5f9 to
05ae16a
Compare
b0d7fec to
7c463e8
Compare
05ae16a to
4ec56a4
Compare
7c463e8 to
b818a93
Compare
4ec56a4 to
002f3bf
Compare
b818a93 to
1c302eb
Compare
6f9b6c4 to
65e137b
Compare
3075076 to
085dfa9
Compare
3c882e7 to
5b64e6c
Compare
02b9bdf to
7effd69
Compare
5b64e6c to
317c444
Compare
7effd69 to
35ca88a
Compare
317c444 to
a9b8bb3
Compare
aa66464 to
1a55d8c
Compare
| { | ||
| public static bool IsNetFxOnly(this TargetFrameworks tfm) | ||
| { | ||
| return ((uint)(tfm & (~(TargetFrameworks.NET461 | TargetFrameworks.NET462)))) == 0; |
andrewlock
left a comment
There was a problem hiding this comment.
LGTM, nice work 👍 Spotted a couple of bugs tho.
I wonder if we could/should simplify TargetFrameworks - shouldn't they only include the TFMs we actually target? 🤔
| { | ||
| public static bool IsNetFxOnly(this TargetFrameworks tfm) | ||
| { | ||
| return ((uint)(tfm & (~(TargetFrameworks.NET461 | TargetFrameworks.NET462)))) == 0; |
There was a problem hiding this comment.
Technically this isn't correct, e.g.:
| return ((uint)(tfm & (~(TargetFrameworks.NET461 | TargetFrameworks.NET462)))) == 0; | |
| return tfm != TargetFrameworks.None | |
| && ((uint)(tfm & (~(TargetFrameworks.NET461 | TargetFrameworks.NET462)))) == 0; |
There was a problem hiding this comment.
But tbh, I would be inclined to do this 😄
| return ((uint)(tfm & (~(TargetFrameworks.NET461 | TargetFrameworks.NET462)))) == 0; | |
| return tfm == TargetFrameworks.NET461 | |
| || tfm == TargetFrameworks.NET462 | |
| || tfm == (TargetFrameworks.NET461 | TargetFrameworks.NET462); |
In fact, why aren't we only defining the values that this can be (i.e. our Datadog.Trace.dll TFMs 🤔) i.e.
internal enum TargetFrameworks : uint
{
None = 0, // For CodeGenerator only
NET462 = 1,
NETSTANDARD2_0 = 2,
NETCOREAPP3_1 = 4,
NET6_0 = 8,
}There was a problem hiding this comment.
Yeah, I see your point. It simplifies casuistic. Fine.
| @@ -27,3 +27,12 @@ internal enum TargetFrameworks : uint | |||
| NET8_0 = 512, | |||
| NET0_0 = 1024, | |||
There was a problem hiding this comment.
Yep, removed in the simplification process
1a55d8c to
dc3139d
Compare
## Summary of changes
Remove windows only definitions from non windows dlls
## Reason for change
Defs take up space. Removing non needed ones will help keep package size
as low as possible
## Implementation details
Surround windows only defs in #if _WIN32 clauses
## Test coverage
## Other details
<!-- Fixes #{issue} -->
<!-- ⚠️ Note: where possible, please obtain 2 approvals prior to
merging. Unless CODEOWNERS specifies otherwise, for external teams it is
typically best to have one review from a team member, and one review
from apm-dotnet. Trivial changes do not require 2 reviews. -->

Summary of changes
Remove windows only definitions from non windows dlls
Reason for change
Defs take up space. Removing non needed ones will help keep package size as low as possible
Implementation details
Surround windows only defs in #if _WIN32 clauses
Test coverage
Other details