Skip to content

Conversation

@andrewlock
Copy link
Member

Summary of changes

Repurposes the now-defunct PublicApiAnalyzer to an InternalForTestingAnalyzer

Reason for change

We have various methods in Datadog.Trace that should never be called by production code, and are only exposed to make testing functionality easier. Currently we rely on method names and comments to avoid this. With this change, we can add an attribute instead, and using the method from Datadog.Trace etc becomes a build error.

Implementation details

  • Basically just renamed PublicApi* -> InternalForTesting*
  • Decorated methods that were currently relying on comments/naming to avoid being called

Test coverage

Refactored the analyzer tests, so should still be covered the same

Other details

Note that there are a bunch of comments for methods // internal for testing which are a bit different. In those cases, we do call it in Datadog.Trace, the comment is just explaining why the method isn't private. Those remain as-is, this attribute is purely if you have a "don't call this method in production code, use that other one instead" method 😄

Part of a stack

@andrewlock andrewlock added the type:cleanup Minor code clean up label Nov 6, 2025
@andrewlock andrewlock requested a review from a team as a code owner November 6, 2025 13:12
@andrewlock andrewlock requested a review from a team as a code owner November 6, 2025 13:12
@datadog-datadog-prod-us1

This comment has been minimized.

@andrewlock andrewlock force-pushed the andrew/internal-for-testing-analyzer branch from 313bd46 to 8cc08a8 Compare November 6, 2025 14:44
@andrewlock andrewlock requested review from a team as code owners November 6, 2025 14:44
@andrewlock andrewlock force-pushed the andrew/remove-unused-enum-members branch from 2f81847 to d7a6df3 Compare November 6, 2025 14:44
@dd-trace-dotnet-ci-bot
Copy link

dd-trace-dotnet-ci-bot bot commented Nov 6, 2025

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (7788) and master.

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration76.01 ± (75.91 - 76.54) ms74.41 ± (74.25 - 74.87) ms-2.1%
.NET Framework 4.8 - Bailout
duration81.16 ± (80.88 - 81.52) ms79.56 ± (79.66 - 80.30) ms-2.0%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1115.67 ± (1118.53 - 1129.48) ms1093.70 ± (1099.54 - 1109.56) ms-2.0%
.NET Core 3.1 - Baseline
process.internal_duration_ms23.18 ± (23.07 - 23.29) ms22.86 ± (22.78 - 22.95) ms-1.4%
process.time_to_main_ms89.02 ± (88.62 - 89.42) ms87.26 ± (86.92 - 87.61) ms-2.0%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.91 ± (10.90 - 10.91) MB10.87 ± (10.87 - 10.88) MB-0.3%
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms22.98 ± (22.89 - 23.07) ms22.65 ± (22.59 - 22.72) ms-1.4%
process.time_to_main_ms89.07 ± (88.63 - 89.52) ms88.77 ± (88.39 - 89.15) ms-0.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.95 ± (10.94 - 10.95) MB10.91 ± (10.91 - 10.91) MB-0.3%
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms221.69 ± (220.39 - 222.98) ms220.60 ± (219.04 - 222.15) ms-0.5%
process.time_to_main_ms554.33 ± (553.23 - 555.42) ms544.58 ± (543.40 - 545.76) ms-1.8%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed52.74 ± (52.72 - 52.77) MB52.41 ± (52.39 - 52.43) MB-0.6%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.1%
.NET 6 - Baseline
process.internal_duration_ms21.71 ± (21.65 - 21.77) ms21.68 ± (21.61 - 21.75) ms-0.1%
process.time_to_main_ms76.13 ± (75.83 - 76.44) ms75.70 ± (75.37 - 76.03) ms-0.6%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.59 ± (10.59 - 10.59) MB10.60 ± (10.60 - 10.61) MB+0.1%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms21.65 ± (21.60 - 21.71) ms21.50 ± (21.44 - 21.56) ms-0.7%
process.time_to_main_ms78.17 ± (77.85 - 78.48) ms75.52 ± (75.24 - 75.80) ms-3.4%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.64 ± (10.64 - 10.64) MB10.63 ± (10.63 - 10.64) MB-0.1%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms213.22 ± (210.53 - 215.91) ms207.67 ± (206.32 - 209.01) ms-2.6%
process.time_to_main_ms516.32 ± (515.25 - 517.38) ms509.45 ± (508.38 - 510.53) ms-1.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed51.81 ± (51.78 - 51.83) MB51.44 ± (51.41 - 51.46) MB-0.7%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.0%
.NET 8 - Baseline
process.internal_duration_ms19.80 ± (19.74 - 19.85) ms19.70 ± (19.64 - 19.76) ms-0.5%
process.time_to_main_ms75.20 ± (74.93 - 75.46) ms74.15 ± (73.88 - 74.42) ms-1.4%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.64 ± (7.64 - 7.65) MB7.62 ± (7.62 - 7.63) MB-0.3%
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms19.86 ± (19.81 - 19.92) ms19.78 ± (19.72 - 19.84) ms-0.4%
process.time_to_main_ms76.63 ± (76.34 - 76.92) ms76.28 ± (75.97 - 76.58) ms-0.5%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.69 ± (7.69 - 7.70) MB7.67 ± (7.66 - 7.68) MB-0.3%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms190.55 ± (189.68 - 191.41) ms192.93 ± (191.97 - 193.90) ms+1.3%✅⬆️
process.time_to_main_ms490.93 ± (490.03 - 491.82) ms490.26 ± (489.10 - 491.41) ms-0.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed39.12 ± (39.09 - 39.16) MB38.74 ± (38.70 - 38.77) MB-1.0%
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.1%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration192.91 ± (192.80 - 193.64) ms192.18 ± (192.02 - 192.56) ms-0.4%
.NET Framework 4.8 - Bailout
duration196.21 ± (196.07 - 196.78) ms195.73 ± (195.55 - 195.99) ms-0.2%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1158.48 ± (1166.13 - 1176.14) ms1158.29 ± (1160.48 - 1169.18) ms-0.0%
.NET Core 3.1 - Baseline
process.internal_duration_ms188.15 ± (187.77 - 188.53) ms187.67 ± (187.24 - 188.11) ms-0.3%
process.time_to_main_ms80.88 ± (80.64 - 81.12) ms80.61 ± (80.40 - 80.82) ms-0.3%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.03 ± (16.00 - 16.05) MB16.14 ± (16.12 - 16.16) MB+0.7%✅⬆️
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (19 - 20)+0.0%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms187.06 ± (186.75 - 187.37) ms187.02 ± (186.69 - 187.36) ms-0.0%
process.time_to_main_ms81.83 ± (81.69 - 81.96) ms81.89 ± (81.75 - 82.02) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.12 ± (16.10 - 16.15) MB16.19 ± (16.15 - 16.23) MB+0.4%✅⬆️
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)+0.8%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms391.50 ± (388.85 - 394.14) ms399.22 ± (396.54 - 401.90) ms+2.0%✅⬆️
process.time_to_main_ms515.07 ± (514.44 - 515.70) ms513.85 ± (513.13 - 514.56) ms-0.2%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed62.68 ± (62.53 - 62.83) MB63.01 ± (62.87 - 63.16) MB+0.5%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.0%
.NET 6 - Baseline
process.internal_duration_ms191.20 ± (190.88 - 191.52) ms190.76 ± (190.40 - 191.12) ms-0.2%
process.time_to_main_ms69.95 ± (69.77 - 70.14) ms69.55 ± (69.39 - 69.70) ms-0.6%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed15.90 ± (15.75 - 16.06) MB16.01 ± (15.86 - 16.16) MB+0.7%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.1%
.NET 6 - Bailout
process.internal_duration_ms190.34 ± (190.04 - 190.64) ms191.37 ± (190.96 - 191.78) ms+0.5%✅⬆️
process.time_to_main_ms70.70 ± (70.60 - 70.80) ms70.94 ± (70.75 - 71.12) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed15.69 ± (15.52 - 15.86) MB16.28 ± (16.19 - 16.36) MB+3.8%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 19)20 ± (20 - 20)+6.7%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms406.09 ± (403.14 - 409.03) ms416.09 ± (412.98 - 419.20) ms+2.5%✅⬆️
process.time_to_main_ms485.90 ± (485.25 - 486.54) ms486.77 ± (485.98 - 487.56) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed62.07 ± (61.89 - 62.25) MB62.24 ± (62.13 - 62.36) MB+0.3%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 30)+0.0%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms190.37 ± (189.92 - 190.81) ms193.62 ± (193.21 - 194.03) ms+1.7%✅⬆️
process.time_to_main_ms69.51 ± (69.31 - 69.70) ms70.81 ± (70.58 - 71.03) ms+1.9%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.71 ± (11.68 - 11.73) MB11.67 ± (11.65 - 11.69) MB-0.3%
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)+0.5%✅⬆️
.NET 8 - Bailout
process.internal_duration_ms189.13 ± (188.92 - 189.35) ms193.33 ± (192.88 - 193.77) ms+2.2%✅⬆️
process.time_to_main_ms70.50 ± (70.40 - 70.60) ms71.86 ± (71.68 - 72.05) ms+1.9%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.67 ± (11.58 - 11.76) MB11.74 ± (11.72 - 11.77) MB+0.6%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+2.9%✅⬆️
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms359.15 ± (357.69 - 360.60) ms361.22 ± (359.87 - 362.57) ms+0.6%✅⬆️
process.time_to_main_ms465.60 ± (465.02 - 466.18) ms461.76 ± (460.94 - 462.58) ms-0.8%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed50.67 ± (50.63 - 50.71) MB50.17 ± (50.15 - 50.20) MB-1.0%
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)+0.1%✅⬆️
Comparison explanation

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 highlighted 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).

Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7788) - mean (75ms)  : 70, 79
    master - mean (76ms)  : 72, 81

    section Bailout
    This PR (7788) - mean (80ms)  : 75, 85
    master - mean (81ms)  : 77, 86

    section CallTarget+Inlining+NGEN
    This PR (7788) - mean (1,105ms)  : 1029, 1180
    master - mean (1,124ms)  : 1038, 1210

Loading
FakeDbCommand (.NET Core 3.1)
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7788) - mean (118ms)  : 112, 124
    master - mean (120ms)  : 112, 128

    section Bailout
    This PR (7788) - mean (119ms)  : 113, 125
    master - mean (120ms)  : 112, 128

    section CallTarget+Inlining+NGEN
    This PR (7788) - mean (804ms)  : 761, 848
    master - mean (816ms)  : 782, 849

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7788) - mean (104ms)  : 99, 110
    master - mean (105ms)  : 100, 110

    section Bailout
    This PR (7788) - mean (104ms)  : 99, 109
    master - mean (107ms)  : 101, 112

    section CallTarget+Inlining+NGEN
    This PR (7788) - mean (748ms)  : 710, 787
    master - mean (764ms)  : 710, 819

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7788) - mean (102ms)  : 96, 108
    master - mean (103ms)  : 98, 108

    section Bailout
    This PR (7788) - mean (105ms)  : 98, 111
    master - mean (105ms)  : 100, 110

    section CallTarget+Inlining+NGEN
    This PR (7788) - mean (715ms)  : 674, 756
    master - mean (720ms)  : 693, 747

Loading
HttpMessageHandler (.NET Framework 4.8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7788) - mean (192ms)  : 190, 195
    master - mean (193ms)  : 189, 197

    section Bailout
    This PR (7788) - mean (196ms)  : 194, 198
    master - mean (196ms)  : 193, 200

    section CallTarget+Inlining+NGEN
    This PR (7788) - mean (1,165ms)  : 1101, 1228
    master - mean (1,171ms)  : 1093, 1249

Loading
HttpMessageHandler (.NET Core 3.1)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7788) - mean (277ms)  : 271, 283
    master - mean (277ms)  : 272, 283

    section Bailout
    This PR (7788) - mean (277ms)  : 272, 282
    master - mean (277ms)  : 274, 280

    section CallTarget+Inlining+NGEN
    This PR (7788) - mean (948ms)  : 906, 991
    master - mean (948ms)  : 905, 991

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7788) - mean (269ms)  : 264, 273
    master - mean (269ms)  : 264, 275

    section Bailout
    This PR (7788) - mean (272ms)  : 261, 282
    master - mean (269ms)  : 266, 272

    section CallTarget+Inlining+NGEN
    This PR (7788) - mean (937ms)  : 891, 982
    master - mean (928ms)  : 884, 973

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7788) - mean (274ms)  : 264, 284
    master - mean (270ms)  : 263, 276

    section Bailout
    This PR (7788) - mean (275ms)  : 267, 282
    master - mean (269ms)  : 266, 273

    section CallTarget+Inlining+NGEN
    This PR (7788) - mean (854ms)  : 825, 883
    master - mean (856ms)  : 837, 874

Loading

@pr-commenter
Copy link

pr-commenter bot commented Nov 6, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7788 compared to master:

  • 2 benchmarks are slower, with geometric mean 1.620
  • 4 benchmarks have fewer allocations
  • 6 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 #7788

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.06 KB 6.14 KB 83 B 1.37%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.5μs 59.9ns 436ns 0 0 0 5.49 KB
master StartStopWithChild netcoreapp3.1 13.3μs 71.8ns 400ns 0 0 0 5.72 KB
master StartStopWithChild net472 21.9μs 123ns 881ns 0.896 0.224 0 6.06 KB
#7788 StartStopWithChild net6.0 10.8μs 46.1ns 178ns 0 0 0 5.5 KB
#7788 StartStopWithChild netcoreapp3.1 13.4μs 65.9ns 280ns 0 0 0 5.71 KB
#7788 StartStopWithChild net472 21.9μs 121ns 781ns 0.972 0.216 0 6.14 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 935μs 181ns 700ns 0 0 0 2.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.03ms 187ns 723ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.23ms 555ns 2.15μs 0 0 0 3.31 KB
#7788 WriteAndFlushEnrichedTraces net6.0 928μs 127ns 475ns 0 0 0 2.71 KB
#7788 WriteAndFlushEnrichedTraces netcoreapp3.1 1.05ms 237ns 916ns 0 0 0 2.7 KB
#7788 WriteAndFlushEnrichedTraces net472 1.22ms 1.85μs 7.15μs 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 1.04μs 6.12ns 60ns 0 0 0 1.22 KB
master AllCycleSimpleBody netcoreapp3.1 1.44μs 5.74ns 21.5ns 0 0 0 1.2 KB
master AllCycleSimpleBody net472 1.03μs 0.321ns 1.2ns 0.192 0 0 1.23 KB
master AllCycleMoreComplexBody net6.0 7.14μs 34.9ns 156ns 0 0 0 4.72 KB
master AllCycleMoreComplexBody netcoreapp3.1 8.93μs 41.4ns 166ns 0 0 0 4.62 KB
master AllCycleMoreComplexBody net472 7.62μs 3.99ns 14.9ns 0.725 0 0 4.74 KB
master ObjectExtractorSimpleBody net6.0 324ns 1.62ns 7.24ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 395ns 2.17ns 13.4ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 299ns 0.0309ns 0.116ns 0.0437 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.31μs 33ns 165ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.86μs 37.3ns 149ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.75μs 4.57ns 17.7ns 0.576 0 0 3.8 KB
#7788 AllCycleSimpleBody net6.0 1.06μs 5.92ns 37.5ns 0 0 0 1.22 KB
#7788 AllCycleSimpleBody netcoreapp3.1 1.4μs 6.91ns 30.1ns 0 0 0 1.2 KB
#7788 AllCycleSimpleBody net472 1.03μs 1.16ns 4.5ns 0.19 0 0 1.23 KB
#7788 AllCycleMoreComplexBody net6.0 7.16μs 38.9ns 217ns 0 0 0 4.72 KB
#7788 AllCycleMoreComplexBody netcoreapp3.1 9.15μs 44.5ns 189ns 0 0 0 4.62 KB
#7788 AllCycleMoreComplexBody net472 7.61μs 2.7ns 10.5ns 0.727 0 0 4.74 KB
#7788 ObjectExtractorSimpleBody net6.0 321ns 0.0909ns 0.34ns 0 0 0 280 B
#7788 ObjectExtractorSimpleBody netcoreapp3.1 405ns 2.03ns 9.07ns 0 0 0 272 B
#7788 ObjectExtractorSimpleBody net472 300ns 0.0341ns 0.128ns 0.0434 0 0 281 B
#7788 ObjectExtractorMoreComplexBody net6.0 6.35μs 30.4ns 129ns 0 0 0 3.78 KB
#7788 ObjectExtractorMoreComplexBody netcoreapp3.1 7.92μs 26.2ns 98.1ns 0 0 0 3.69 KB
#7788 ObjectExtractorMoreComplexBody net472 6.69μs 5.91ns 22.9ns 0.601 0 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 76.1μs 299ns 1.12μs 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 98.3μs 218ns 843ns 0 0 0 32.4 KB
master EncodeArgs net472 110μs 166ns 643ns 4.98 0 0 32.51 KB
master EncodeLegacyArgs net6.0 148μs 41ns 153ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 196μs 70.2ns 272ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 264μs 86.7ns 336ns 0 0 0 2.16 KB
#7788 EncodeArgs net6.0 79.3μs 117ns 452ns 0 0 0 32.4 KB
#7788 EncodeArgs netcoreapp3.1 98.6μs 226ns 877ns 0 0 0 32.4 KB
#7788 EncodeArgs net472 112μs 33.2ns 124ns 5.04 0 0 32.51 KB
#7788 EncodeLegacyArgs net6.0 148μs 71.4ns 277ns 0 0 0 2.15 KB
#7788 EncodeLegacyArgs netcoreapp3.1 197μs 90.3ns 313ns 0 0 0 2.14 KB
#7788 EncodeLegacyArgs net472 264μs 43.7ns 158ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #7788

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑netcoreapp3.1 2.348 307,801.09 722,772.25

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 407μs 159ns 616ns 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 836μs 13μs 128μs 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 446μs 57.8ns 224ns 0 0 0 4.66 KB
master RunWafRealisticBenchmarkWithAttack net6.0 296μs 33.8ns 126ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 308μs 189ns 732ns 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 331μs 42.5ns 165ns 0 0 0 2.29 KB
#7788 RunWafRealisticBenchmark net6.0 395μs 110ns 425ns 0 0 0 4.55 KB
#7788 RunWafRealisticBenchmark netcoreapp3.1 831μs 9.8μs 97.5μs 0 0 0 4.48 KB
#7788 RunWafRealisticBenchmark net472 431μs 78.6ns 304ns 0 0 0 4.66 KB
#7788 RunWafRealisticBenchmarkWithAttack net6.0 289μs 169ns 654ns 0 0 0 2.24 KB
#7788 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 713μs 4.96μs 49.6μs 0 0 0 2.22 KB
#7788 RunWafRealisticBenchmarkWithAttack net472 308μs 37.7ns 146ns 0 0 0 2.29 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 60.8μs 38.7ns 145ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 72.6μs 239ns 861ns 0 0 0 17.42 KB
master SendRequest net472 0.00857ns 0.00228ns 0.00882ns 0 0 0 0 b
#7788 SendRequest net6.0 60.8μs 39.3ns 147ns 0 0 0 14.52 KB
#7788 SendRequest netcoreapp3.1 71.5μs 195ns 729ns 0 0 0 17.42 KB
#7788 SendRequest net472 0.0102ns 0.00222ns 0.00859ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #7788

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑netcoreapp3.1 1.117 1,664,870.00 1,859,873.75

More allocations ⚠️ in #7788

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net472 0 b 73 B 73 B
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net472 0 b 48 B 48 B
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 3 B 5 B 2 B 66.67%

Fewer allocations 🎉 in #7788

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑netcoreapp3.1 1 B 0 b -1 B -100.00%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.93ms 955ns 3.57μs 0 0 0 640.01 KB
master OriginalCharSlice netcoreapp3.1 2.12ms 6.81μs 25.5μs 0 0 0 640 KB
master OriginalCharSlice net472 2.62ms 385ns 1.44μs 100 0 0 641.95 KB
master OptimizedCharSlice net6.0 1.39ms 160ns 599ns 0 0 0 7 B
master OptimizedCharSlice netcoreapp3.1 1.67ms 396ns 1.53μs 0 0 0 1 B
master OptimizedCharSlice net472 1.96ms 219ns 848ns 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 809μs 32.2ns 125ns 0 0 0 3 B
master OptimizedCharSliceWithPool netcoreapp3.1 804μs 280ns 1.05μs 0 0 0 1 B
master OptimizedCharSliceWithPool net472 1.17ms 75.7ns 283ns 0 0 0 0 b
#7788 OriginalCharSlice net6.0 1.94ms 346ns 1.29μs 0 0 0 640.01 KB
#7788 OriginalCharSlice netcoreapp3.1 2.27ms 5.03μs 19.5μs 0 0 0 640 KB
#7788 OriginalCharSlice net472 2.57ms 155ns 601ns 100 0 0 641.95 KB
#7788 OptimizedCharSlice net6.0 1.51ms 388ns 1.5μs 0 0 0 7 B
#7788 OptimizedCharSlice netcoreapp3.1 1.82ms 10.4μs 79.2μs 0 0 0 1 B
#7788 OptimizedCharSlice net472 2.06ms 220ns 851ns 0 0 0 73 B
#7788 OptimizedCharSliceWithPool net6.0 855μs 77ns 288ns 0 0 0 5 B
#7788 OptimizedCharSliceWithPool netcoreapp3.1 797μs 113ns 438ns 0 0 0 0 b
#7788 OptimizedCharSliceWithPool net472 1.15ms 157ns 608ns 0 0 0 48 B
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7788

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 56.56 KB 56.01 KB -547 B -0.97%
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 42.22 KB 41.75 KB -470 B -1.11%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 709μs 2.9μs 11.2μs 0 0 0 42.22 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 748μs 1.59μs 6.94μs 0 0 0 41.75 KB
master WriteAndFlushEnrichedTraces net472 875μs 4.4μs 18.7μs 8.33 0 0 56.56 KB
#7788 WriteAndFlushEnrichedTraces net6.0 752μs 4.26μs 28.9μs 0 0 0 41.75 KB
#7788 WriteAndFlushEnrichedTraces netcoreapp3.1 741μs 3.9μs 19.5μs 0 0 0 41.89 KB
#7788 WriteAndFlushEnrichedTraces net472 862μs 2.52μs 9.07μs 8.33 0 0 56.01 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.92μs 7.57ns 30.3ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.55μs 12.4ns 54ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.82μs 4.2ns 16.3ns 0.156 0.0142 0 987 B
#7788 ExecuteNonQuery net6.0 1.87μs 8.92ns 36.8ns 0 0 0 1.02 KB
#7788 ExecuteNonQuery netcoreapp3.1 2.65μs 9.56ns 37ns 0 0 0 1.02 KB
#7788 ExecuteNonQuery net472 2.85μs 2.92ns 11.3ns 0.155 0.0141 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.74μs 4.27ns 16.5ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.24μs 10.3ns 40ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.45μs 2.8ns 10.9ns 0.156 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.91μs 0.697ns 2.51ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.37μs 1.02ns 3.66ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.58μs 1.94ns 7.28ns 0.161 0 0 1.1 KB
#7788 CallElasticsearch net6.0 1.75μs 0.51ns 1.77ns 0 0 0 1.03 KB
#7788 CallElasticsearch netcoreapp3.1 2.29μs 8.67ns 33.6ns 0 0 0 1.03 KB
#7788 CallElasticsearch net472 3.45μs 1.76ns 6.81ns 0.158 0 0 1.04 KB
#7788 CallElasticsearchAsync net6.0 1.81μs 8.65ns 34.6ns 0 0 0 1.01 KB
#7788 CallElasticsearchAsync netcoreapp3.1 2.54μs 12.7ns 53.8ns 0 0 0 1.08 KB
#7788 CallElasticsearchAsync net472 3.7μs 3.53ns 13.7ns 0.167 0 0 1.1 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.84μs 3.2ns 12.4ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.41μs 7.43ns 28.8ns 0 0 0 952 B
master ExecuteAsync net472 2.63μs 2.03ns 7.85ns 0.145 0 0 915 B
#7788 ExecuteAsync net6.0 1.84μs 10.1ns 58.9ns 0 0 0 952 B
#7788 ExecuteAsync netcoreapp3.1 2.44μs 8.32ns 32.2ns 0 0 0 952 B
#7788 ExecuteAsync net472 2.74μs 1.56ns 6.03ns 0.137 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 6.83μs 15ns 58.3ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.83μs 22.7ns 87.8ns 0 0 0 2.9 KB
master SendAsync net472 11.9μs 10.3ns 40.1ns 0.474 0 0 3.18 KB
#7788 SendAsync net6.0 7.05μs 10.6ns 40.9ns 0 0 0 2.36 KB
#7788 SendAsync netcoreapp3.1 8.78μs 26.1ns 101ns 0 0 0 2.9 KB
#7788 SendAsync net472 12.1μs 10.8ns 41.8ns 0.483 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7788

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 42.82 KB 44.46 KB 1.64 KB 3.83%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 273.7 KB 275.91 KB 2.21 KB 0.81%

Fewer allocations 🎉 in #7788

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 44.14 KB 43.83 KB -312 B -0.71%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 47μs 358ns 3.34μs 0 0 0 44.14 KB
master StringConcatBenchmark netcoreapp3.1 58.1μs 952ns 9.47μs 0 0 0 42.82 KB
master StringConcatBenchmark net472 56.3μs 280ns 1.25μs 0 0 0 57.34 KB
master StringConcatAspectBenchmark net6.0 447μs 1.25μs 4.32μs 0 0 0 256.72 KB
master StringConcatAspectBenchmark netcoreapp3.1 554μs 2.63μs 10.8μs 0 0 0 273.7 KB
master StringConcatAspectBenchmark net472 405μs 2.21μs 12.1μs 0 0 0 277.8 KB
#7788 StringConcatBenchmark net6.0 53.7μs 852ns 8.44μs 0 0 0 43.83 KB
#7788 StringConcatBenchmark netcoreapp3.1 55.9μs 649ns 6.46μs 0 0 0 44.46 KB
#7788 StringConcatBenchmark net472 58.2μs 133ns 480ns 0 0 0 57.34 KB
#7788 StringConcatAspectBenchmark net6.0 461μs 2.25μs 9.55μs 0 0 0 258 KB
#7788 StringConcatAspectBenchmark netcoreapp3.1 498μs 1.41μs 6.62μs 0 0 0 275.91 KB
#7788 StringConcatAspectBenchmark net472 407μs 2.14μs 10.9μ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.58μs 13ns 61.1ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.64μs 17.3ns 69.3ns 0 0 0 1.7 KB
master EnrichedLog net472 3.85μs 3.18ns 12.3ns 0.249 0 0 1.64 KB
#7788 EnrichedLog net6.0 2.64μs 1.54ns 5.95ns 0 0 0 1.7 KB
#7788 EnrichedLog netcoreapp3.1 3.56μs 10.2ns 39.3ns 0 0 0 1.7 KB
#7788 EnrichedLog net472 3.89μs 6.6ns 25.6ns 0.252 0 0 1.64 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 131μs 673ns 3.16μs 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 141μs 637ns 2.47μs 0 0 0 4.31 KB
master EnrichedLog net472 181μs 892ns 3.78μs 0 0 0 4.52 KB
#7788 EnrichedLog net6.0 123μs 65.3ns 253ns 0 0 0 4.31 KB
#7788 EnrichedLog netcoreapp3.1 129μs 129ns 481ns 0 0 0 4.31 KB
#7788 EnrichedLog net472 170μs 134ns 518ns 0 0 0 4.52 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.06μs 2.6ns 9.71ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.78μs 6.6ns 25.5ns 0 0 0 2.26 KB
master EnrichedLog net472 7.56μs 8.06ns 31.2ns 0.3 0 0 2.08 KB
#7788 EnrichedLog net6.0 5.06μs 10.4ns 40.4ns 0 0 0 2.26 KB
#7788 EnrichedLog netcoreapp3.1 7.02μs 17.8ns 68.8ns 0 0 0 2.26 KB
#7788 EnrichedLog net472 7.54μs 11.1ns 42.9ns 0.302 0 0 2.08 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.01μs 10.1ns 43.9ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.68μs 6.08ns 23.6ns 0 0 0 1.2 KB
master SendReceive net472 3.02μs 2.73ns 10.6ns 0.18 0 0 1.2 KB
#7788 SendReceive net6.0 1.97μs 9.6ns 42.9ns 0 0 0 1.2 KB
#7788 SendReceive netcoreapp3.1 2.59μs 11.2ns 43.2ns 0 0 0 1.2 KB
#7788 SendReceive net472 3.05μs 3.79ns 14.7ns 0.182 0 0 1.2 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.5μs 21.5ns 83.3ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.51μs 13.7ns 52.9ns 0 0 0 1.63 KB
master EnrichedLog net472 6.93μs 9.31ns 36.1ns 0.309 0 0 2.03 KB
#7788 EnrichedLog net6.0 4.14μs 12.8ns 46.3ns 0 0 0 1.58 KB
#7788 EnrichedLog netcoreapp3.1 5.48μs 11.3ns 43.9ns 0 0 0 1.63 KB
#7788 EnrichedLog net472 6.7μs 4.65ns 18ns 0.302 0 0 2.03 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 772ns 3.64ns 15ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 959ns 4.77ns 21.4ns 0 0 0 576 B
master StartFinishSpan net472 949ns 0.0993ns 0.371ns 0.0917 0 0 578 B
master StartFinishScope net6.0 916ns 1.69ns 6.31ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.2μs 6.11ns 29.3ns 0 0 0 696 B
master StartFinishScope net472 1.14μs 0.215ns 0.806ns 0.103 0 0 658 B
#7788 StartFinishSpan net6.0 775ns 3.52ns 14.1ns 0 0 0 576 B
#7788 StartFinishSpan netcoreapp3.1 958ns 4.71ns 18.2ns 0 0 0 576 B
#7788 StartFinishSpan net472 977ns 0.497ns 1.93ns 0.0883 0 0 578 B
#7788 StartFinishScope net6.0 951ns 0.55ns 2.13ns 0 0 0 696 B
#7788 StartFinishScope netcoreapp3.1 1.2μs 6.01ns 24ns 0 0 0 696 B
#7788 StartFinishScope net472 1.14μs 0.15ns 0.58ns 0.103 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 1.05μs 4.93ns 20.3ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.41μs 7.32ns 35.1ns 0 0 0 696 B
master RunOnMethodBegin net472 1.46μs 2.39ns 9.25ns 0.102 0 0 658 B
#7788 RunOnMethodBegin net6.0 1.08μs 4.19ns 16.2ns 0 0 0 696 B
#7788 RunOnMethodBegin netcoreapp3.1 1.41μs 7.09ns 30.9ns 0 0 0 696 B
#7788 RunOnMethodBegin net472 1.44μs 0.678ns 2.54ns 0.101 0 0 658 B

@andrewlock andrewlock force-pushed the andrew/internal-for-testing-analyzer branch from 8cc08a8 to 0312a2a Compare November 7, 2025 10:06
@andrewlock andrewlock force-pushed the andrew/remove-unused-enum-members branch from d7a6df3 to 3c51752 Compare November 7, 2025 10:06
Copy link
Collaborator

@bouwkast bouwkast left a comment

Choose a reason for hiding this comment

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

👍

@lucaspimentel
Copy link
Member

lucaspimentel commented Nov 7, 2025

Note that there are a bunch of comments for methods // internal for testing which are a bit different. In those cases, we do call it in Datadog.Trace, the comment is just explaining why the method isn't private.

I just assume anything that's internal means "could be private, but we call it from test code" (why else would they be internal?), so those // internal for testing comments seem redundant (but level of care low).


// Internal for testing only
[InternalForTesting]
public NameValueConfigurationSource(NameValueCollection nameValueCollection)
Copy link
Member

Choose a reason for hiding this comment

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

This is public, not internal.

Copy link
Member Author

@andrewlock andrewlock Nov 10, 2025

Choose a reason for hiding this comment

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

Yeah, but public/internal is irrelevant in Datadog.Trace world😛 Everything public could be internal and vice versa 😉 Maybe we should just have an analyzer that forces us to use public instead of internal for consistency? Or vice versa? 🤷‍♂️

/// <param name="spanId">The propagated span id.</param>
/// <param name="samplingPriority">The propagated sampling priority.</param>
/// <param name="serviceName">The service name to propagate to child spans.</param>
[InternalForTesting]
Copy link
Member

Choose a reason for hiding this comment

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

This is public, not internal.

@andrewlock
Copy link
Member Author

Note that there are a bunch of comments for methods // internal for testing which are a bit different. In those cases, we do call it in Datadog.Trace, the comment is just explaining why the method isn't private.

I just assume anything that's internal means "could be private, but we call it from test code" (why else would they be internal?), so those // internal for testing comments seem redundant (but level of care low).

I think there's a difference.

  • Some code is internal/public because it needs to be, and it should be called by other consumers. This code isn't marked by any comments today, it's just "normal" public API surface.
  • Some code is internal/public only because we want to call it from test code (and it should never be called in "normal" Datadog.Trace usages). These are the cases tracked by the analyzer in this PR today.
  • Some code is internal/public because we want to call if from test code but we also call it "internally". This is code that Should be private, but isn't. This is code currently marked by `//internal for testing"
    • There is a "risk" that production code in Datadog.Trace calls these methods when they shouldn't today.

I might actually tweak this analyzer to account for both cases, so we can remove the comments, and be properly protected 🤔

andrewlock added a commit that referenced this pull request Nov 10, 2025
## Summary of changes

- Remove `[PublicApi]` usages that aren't necessary any more
- Rename `DebugEnabledInternal` => `DebugEnabled`
- Delete some "public" methods that aren't, and are no longer necessary
(as they're unused)

## Reason for change

Cleaning up

## Implementation details

Mostly <kbd>del</kbd>

## Test coverage

Covered by existing

## Other details


Part of a stack

- #7786 👈
- #7787
- #7788
@andrewlock andrewlock force-pushed the andrew/internal-for-testing-analyzer branch from 0312a2a to d4afe02 Compare November 10, 2025 11:26
@andrewlock andrewlock requested review from a team as code owners November 10, 2025 11:26
@andrewlock andrewlock removed the request for review from a team November 10, 2025 11:26
@andrewlock andrewlock requested a review from anna-git November 10, 2025 11:26
@andrewlock andrewlock force-pushed the andrew/remove-unused-enum-members branch from 3c51752 to 6e3d383 Compare November 10, 2025 11:26
andrewlock added a commit that referenced this pull request Nov 10, 2025
## Summary of changes

Deletes a bunch of enum members from `PublicApiUsage` which are unused

## Reason for change

These were unused or _couldn't_ logically be called in production code,
so were just adding overhead as we allocate the array to record them.

Fixed one case where we _Should_ have been recording it, but weren't

## Implementation details

FindAllReferences on each member => if it's not used in Datadog.Trace,
remove it

## Test coverage

Covered by existing

## Other details

Part of a stack

- #7786
- #7787 👈
- #7788
Base automatically changed from andrew/remove-unused-enum-members to master November 10, 2025 12:58
@andrewlock andrewlock force-pushed the andrew/internal-for-testing-analyzer branch 2 times, most recently from ed6fa19 to 4e69bc7 Compare November 11, 2025 11:54
@andrewlock
Copy link
Member Author

FYI @bouwkast @lucaspimentel, I tweaked the naming of the attribute [TestingOnly] to avoid the whole public/internal issue 😅 I also added a variation, [TestingAndPrivateOnly] so that we can get rid of most of the other // internal for testing comments too. In summary

  • [TestingOnly]: Should not be called directly by our library code, only from test code.
  • [TestingAndPrivateOnly]: Can be called from within the same type, or from test code, but not from other types.

@andrewlock andrewlock force-pushed the andrew/internal-for-testing-analyzer branch from 4e69bc7 to 7e6834a Compare November 11, 2025 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tools type:cleanup Minor code clean up

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants