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

Remove PublicApiTests.PublicApiHasNotChanged for Datadog.Trace.dll #6385

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

andrewlock
Copy link
Member

@andrewlock andrewlock commented Dec 3, 2024

Summary of changes

Remove PublicApiTests.PublicApiHasNotChanged for Datadog.Trace.dll

Reason for change

The public API surface of Datadog.Trace is not really public any more, as it's not directly referenced, so these tests are largely unneccessary.

As of right now, public vs internal is essentially irrelevant in this project.

Implementation details

Remove the PublicApiHasNotChanged test. The other public API tests e.g. AssemblyReferencesHaveNotChanged are still relevant, so jumped through some hoops to keep them

Test coverage

Slightly less now.

Other details

Part of stack

@andrewlock andrewlock added area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) area:tests unit tests, integration tests type:cleanup Minor code clean up labels Dec 3, 2024
@andrewlock andrewlock requested a review from a team as a code owner December 3, 2024 11:50
@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Dec 3, 2024

Datadog Report

Branch report: andrew/remove-public-api-tests
Commit report: 8afed3b
Test service: dd-trace-dotnet

✅ 0 Failed, 454525 Passed, 2773 Skipped, 19h 16m 53.9s Total Time
❄️ 1 New Flaky

New Flaky Tests (1)

  • HttpClient_SubmitsTraces - Datadog.Trace.ClrProfiler.IntegrationTests.HttpMessageHandlerTests - Last Failure

    Expand for error
     
     Expected collection to contain a single item matching x.IsRequestType("app-closing"), but no such item was found.rate a span, but found False.lse.
    

@andrewlock
Copy link
Member Author

andrewlock commented Dec 3, 2024

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 (6385) - mean (69ms)  : 66, 72
     .   : milestone, 69,
    master - mean (69ms)  : 66, 72
     .   : milestone, 69,

    section CallTarget+Inlining+NGEN
    This PR (6385) - mean (981ms)  : 960, 1001
     .   : milestone, 981,
    master - mean (983ms)  : 957, 1010
     .   : milestone, 983,

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

    section CallTarget+Inlining+NGEN
    This PR (6385) - mean (681ms)  : 664, 698
     .   : milestone, 681,
    master - mean (678ms)  : 664, 691
     .   : milestone, 678,

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

    section CallTarget+Inlining+NGEN
    This PR (6385) - mean (633ms)  : 616, 650
     .   : milestone, 633,
    master - mean (631ms)  : 614, 648
     .   : milestone, 631,

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

    section CallTarget+Inlining+NGEN
    This PR (6385) - mean (1,093ms)  : 1065, 1121
     .   : milestone, 1093,
    master - mean (1,093ms)  : 1058, 1128
     .   : milestone, 1093,

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

    section CallTarget+Inlining+NGEN
    This PR (6385) - mean (868ms)  : 844, 892
     .   : milestone, 868,
    master - mean (872ms)  : 840, 904
     .   : milestone, 872,

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

    section CallTarget+Inlining+NGEN
    This PR (6385) - mean (850ms)  : 816, 884
     .   : milestone, 850,
    master - mean (851ms)  : 812, 891
     .   : milestone, 851,

Loading

@andrewlock
Copy link
Member Author

andrewlock commented Dec 3, 2024

Benchmarks Report for appsec 🐌

Benchmarks for #6385 compared to master:

  • All benchmarks have the same speed
  • 2 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 - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 218μs 97.8ns 353ns 2.83 0 0 205.48 KB
master AllCycleSimpleBody netcoreapp3.1 319μs 112ns 421ns 2.88 0 0 212.92 KB
master AllCycleSimpleBody net472 281μs 207ns 800ns 38.1 2.93 0 240.1 KB
master AllCycleMoreComplexBody net6.0 220μs 93.8ns 351ns 2.98 0 0 208.98 KB
master AllCycleMoreComplexBody netcoreapp3.1 320μs 146ns 507ns 2.91 0 0 216.34 KB
master AllCycleMoreComplexBody net472 291μs 442ns 1.65μs 38.7 2.89 0 243.62 KB
master ObjectExtractorSimpleBody net6.0 139ns 0.11ns 0.412ns 0.00396 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 199ns 0.156ns 0.604ns 0.00369 0 0 272 B
master ObjectExtractorSimpleBody net472 214ns 0.2ns 0.775ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 2.93μs 0.973ns 3.51ns 0.0528 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 3.75μs 5.03ns 19.5ns 0.0503 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 4.51μs 22.4ns 100ns 0.602 0.00703 0 3.8 KB
#6385 AllCycleSimpleBody net6.0 214μs 90.9ns 352ns 2.83 0 0 205.48 KB
#6385 AllCycleSimpleBody netcoreapp3.1 321μs 153ns 594ns 2.8 0 0 212.92 KB
#6385 AllCycleSimpleBody net472 286μs 311ns 1.2μs 38.2 2.85 0 240.1 KB
#6385 AllCycleMoreComplexBody net6.0 225μs 140ns 542ns 2.94 0.113 0 208.99 KB
#6385 AllCycleMoreComplexBody netcoreapp3.1 322μs 165ns 594ns 2.95 0 0 216.34 KB
#6385 AllCycleMoreComplexBody net472 289μs 412ns 1.54μs 38.6 2.87 0 243.61 KB
#6385 ObjectExtractorSimpleBody net6.0 139ns 0.114ns 0.426ns 0.00395 0 0 280 B
#6385 ObjectExtractorSimpleBody netcoreapp3.1 212ns 0.544ns 2.11ns 0.00368 0 0 272 B
#6385 ObjectExtractorSimpleBody net472 208ns 0.179ns 0.646ns 0.0446 0 0 281 B
#6385 ObjectExtractorMoreComplexBody net6.0 2.88μs 0.95ns 3.68ns 0.0534 0 0 3.78 KB
#6385 ObjectExtractorMoreComplexBody netcoreapp3.1 3.86μs 2.24ns 8.39ns 0.0502 0 0 3.69 KB
#6385 ObjectExtractorMoreComplexBody net472 4.29μs 5.4ns 20.9ns 0.602 0.00634 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 37.4μs 18.2ns 68.2ns 0.447 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 55μs 113ns 425ns 0.435 0 0 32.4 KB
master EncodeArgs net472 67.2μs 42.1ns 158ns 5.15 0.0673 0 32.5 KB
master EncodeLegacyArgs net6.0 78.9μs 35.7ns 124ns 0.0372 0 0 2.14 KB
master EncodeLegacyArgs netcoreapp3.1 104μs 346ns 1.34μs 0 0 0 2.14 KB
master EncodeLegacyArgs net472 156μs 214ns 828ns 0.312 0 0 2.15 KB
#6385 EncodeArgs net6.0 37.9μs 17.1ns 61.5ns 0.458 0 0 32.4 KB
#6385 EncodeArgs netcoreapp3.1 54.3μs 24.3ns 90.8ns 0.432 0 0 32.4 KB
#6385 EncodeArgs net472 67.7μs 59.5ns 230ns 5.13 0.068 0 32.5 KB
#6385 EncodeLegacyArgs net6.0 76.5μs 411ns 2.33μs 0 0 0 2.14 KB
#6385 EncodeLegacyArgs netcoreapp3.1 105μs 70.2ns 272ns 0 0 0 2.14 KB
#6385 EncodeLegacyArgs net472 156μs 68.9ns 267ns 0.313 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 181μs 77.5ns 290ns 0 0 0 2.44 KB
master RunWafRealisticBenchmark netcoreapp3.1 194μs 357ns 1.38μs 0 0 0 2.39 KB
master RunWafRealisticBenchmark net472 207μs 97.4ns 364ns 0.308 0 0 2.46 KB
master RunWafRealisticBenchmarkWithAttack net6.0 122μs 63.2ns 245ns 0 0 0 1.47 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 129μs 104ns 390ns 0 0 0 1.46 KB
master RunWafRealisticBenchmarkWithAttack net472 140μs 68.7ns 257ns 0.21 0 0 1.49 KB
#6385 RunWafRealisticBenchmark net6.0 184μs 68.9ns 248ns 0 0 0 2.44 KB
#6385 RunWafRealisticBenchmark netcoreapp3.1 194μs 302ns 1.17μs 0 0 0 2.39 KB
#6385 RunWafRealisticBenchmark net472 211μs 397ns 1.49μs 0.312 0 0 2.46 KB
#6385 RunWafRealisticBenchmarkWithAttack net6.0 122μs 80ns 288ns 0 0 0 1.47 KB
#6385 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 129μs 119ns 445ns 0 0 0 1.46 KB
#6385 RunWafRealisticBenchmarkWithAttack net472 140μs 110ns 396ns 0.216 0 0 1.49 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #6385

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 253.63 KB 286.46 KB 32.83 KB 12.94%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 57.34 KB 57.8 KB 456 B 0.80%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 60.4μs 969ns 9.69μs 0 0 0 43.44 KB
master StringConcatBenchmark netcoreapp3.1 55.8μs 256ns 1.45μs 0 0 0 42.64 KB
master StringConcatBenchmark net472 37.7μs 105ns 379ns 0 0 0 57.34 KB
master StringConcatAspectBenchmark net6.0 308μs 1.32μs 5.3μs 0 0 0 253.63 KB
master StringConcatAspectBenchmark netcoreapp3.1 354μs 1.93μs 11.8μs 0 0 0 253.63 KB
master StringConcatAspectBenchmark net472 295μs 6.48μs 62.5μs 0 0 0 278.53 KB
#6385 StringConcatBenchmark net6.0 58μs 684ns 6.63μs 0 0 0 43.34 KB
#6385 StringConcatBenchmark netcoreapp3.1 55.5μs 253ns 1.34μs 0 0 0 42.64 KB
#6385 StringConcatBenchmark net472 38.4μs 175ns 656ns 0 0 0 57.8 KB
#6385 StringConcatAspectBenchmark net6.0 312μs 6.84μs 66μs 0 0 0 286.46 KB
#6385 StringConcatAspectBenchmark netcoreapp3.1 334μs 1.94μs 18.1μs 0 0 0 253.85 KB
#6385 StringConcatAspectBenchmark net472 302μs 7.67μs 74.4μs 0 0 0 278.53 KB

@andrewlock
Copy link
Member Author

andrewlock commented Dec 3, 2024

Benchmarks Report for tracer 🐌

Benchmarks for #6385 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.269
  • 1 benchmarks are slower, with geometric mean 1.148
  • 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.11μs 46.2ns 330ns 0.0206 0.00822 0 5.61 KB
master StartStopWithChild netcoreapp3.1 10.1μs 52.7ns 253ns 0.0199 0.00997 0 5.8 KB
master StartStopWithChild net472 16.1μs 62.4ns 242ns 1.05 0.324 0.105 6.21 KB
#6385 StartStopWithChild net6.0 7.99μs 44.3ns 262ns 0.0122 0.00407 0 5.61 KB
#6385 StartStopWithChild netcoreapp3.1 10.5μs 56.9ns 332ns 0.0158 0.00527 0 5.81 KB
#6385 StartStopWithChild net472 16.3μs 59.2ns 229ns 1.05 0.32 0.0985 6.21 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 512μs 207ns 803ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 690μs 540ns 2.09μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 867μs 522ns 1.95μs 0.431 0 0 3.3 KB
#6385 WriteAndFlushEnrichedTraces net6.0 508μs 2.62μs 12μs 0 0 0 2.7 KB
#6385 WriteAndFlushEnrichedTraces netcoreapp3.1 653μs 281ns 1.05μs 0 0 0 2.7 KB
#6385 WriteAndFlushEnrichedTraces net472 851μs 460ns 1.78μ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 152μs 889ns 8.48μs 0.151 0 0 14.47 KB
master SendRequest netcoreapp3.1 168μs 986ns 9.66μs 0.163 0 0 17.27 KB
master SendRequest net472 0.00269ns 0.000968ns 0.00375ns 0 0 0 0 b
#6385 SendRequest net6.0 150μs 949ns 9.49μs 0.159 0 0 14.47 KB
#6385 SendRequest netcoreapp3.1 169μs 961ns 6.86μs 0.164 0 0 17.27 KB
#6385 SendRequest net472 0.000657ns 0.000356ns 0.00138ns 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 546μs 1.93μs 6.97μs 0.543 0 0 41.49 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 647μs 3.01μs 13.1μs 0.324 0 0 41.93 KB
master WriteAndFlushEnrichedTraces net472 846μs 4.16μs 19.1μs 8.33 2.5 0.417 53.29 KB
#6385 WriteAndFlushEnrichedTraces net6.0 553μs 2.96μs 15.9μs 0.546 0 0 41.51 KB
#6385 WriteAndFlushEnrichedTraces netcoreapp3.1 671μs 3.33μs 14.9μs 0.353 0 0 41.79 KB
#6385 WriteAndFlushEnrichedTraces net472 819μs 2.67μs 9.63μs 8.06 2.42 0.403 53.25 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.26μs 1.47ns 5.68ns 0.0139 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 1.73μs 1.07ns 4ns 0.0137 0 0 1.02 KB
master ExecuteNonQuery net472 2.05μs 2.12ns 8.22ns 0.157 0.00103 0 987 B
#6385 ExecuteNonQuery net6.0 1.32μs 1.06ns 4.1ns 0.0145 0 0 1.02 KB
#6385 ExecuteNonQuery netcoreapp3.1 1.78μs 1.04ns 4.02ns 0.0133 0 0 1.02 KB
#6385 ExecuteNonQuery net472 2.09μs 2.81ns 10.5ns 0.156 0.00104 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.28μs 0.545ns 2.04ns 0.0135 0 0 976 B
master CallElasticsearch netcoreapp3.1 1.56μs 1.75ns 6.78ns 0.0132 0 0 976 B
master CallElasticsearch net472 2.62μs 2.27ns 8.79ns 0.157 0 0 995 B
master CallElasticsearchAsync net6.0 1.35μs 0.392ns 1.47ns 0.0129 0 0 952 B
master CallElasticsearchAsync netcoreapp3.1 1.59μs 1.16ns 4.34ns 0.0137 0 0 1.02 KB
master CallElasticsearchAsync net472 2.68μs 1.45ns 5.62ns 0.166 0 0 1.05 KB
#6385 CallElasticsearch net6.0 1.3μs 0.724ns 2.71ns 0.0137 0 0 976 B
#6385 CallElasticsearch netcoreapp3.1 1.54μs 1.52ns 5.88ns 0.013 0 0 976 B
#6385 CallElasticsearch net472 2.69μs 2.59ns 9.68ns 0.157 0 0 995 B
#6385 CallElasticsearchAsync net6.0 1.22μs 0.637ns 2.38ns 0.0134 0 0 952 B
#6385 CallElasticsearchAsync netcoreapp3.1 1.63μs 0.96ns 3.59ns 0.013 0 0 1.02 KB
#6385 CallElasticsearchAsync net472 2.68μs 2.61ns 9.75ns 0.167 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.24μs 0.727ns 2.72ns 0.013 0 0 952 B
master ExecuteAsync netcoreapp3.1 1.68μs 0.673ns 2.43ns 0.0127 0 0 952 B
master ExecuteAsync net472 1.82μs 0.461ns 1.73ns 0.145 0 0 915 B
#6385 ExecuteAsync net6.0 1.22μs 0.58ns 2.17ns 0.0136 0 0 952 B
#6385 ExecuteAsync netcoreapp3.1 1.7μs 2.33ns 8.4ns 0.0127 0 0 952 B
#6385 ExecuteAsync net472 1.82μs 0.807ns 3.13ns 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.6μs 3.96ns 13.7ns 0.0323 0 0 2.31 KB
master SendAsync netcoreapp3.1 5.26μs 2.08ns 8.06ns 0.0395 0 0 2.85 KB
master SendAsync net472 7.36μs 1.75ns 6.79ns 0.493 0 0 3.12 KB
#6385 SendAsync net6.0 4.33μs 1.11ns 4.01ns 0.0325 0 0 2.31 KB
#6385 SendAsync netcoreapp3.1 5.25μs 2.2ns 8.5ns 0.0395 0 0 2.85 KB
#6385 SendAsync net472 7.35μs 2.08ns 8.07ns 0.496 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.57μs 1.12ns 4.19ns 0.0228 0 0 1.64 KB
master EnrichedLog netcoreapp3.1 2.27μs 0.74ns 2.67ns 0.0217 0 0 1.64 KB
master EnrichedLog net472 2.68μs 1.48ns 5.71ns 0.249 0 0 1.57 KB
#6385 EnrichedLog net6.0 1.46μs 0.932ns 3.61ns 0.0227 0 0 1.64 KB
#6385 EnrichedLog netcoreapp3.1 2.3μs 1.07ns 4.15ns 0.0219 0 0 1.64 KB
#6385 EnrichedLog net472 2.61μs 1.88ns 7.02ns 0.249 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 120μs 122ns 474ns 0 0 0 4.28 KB
master EnrichedLog netcoreapp3.1 123μs 101ns 390ns 0.062 0 0 4.28 KB
master EnrichedLog net472 153μs 82.1ns 307ns 0.689 0.23 0 4.46 KB
#6385 EnrichedLog net6.0 118μs 90.1ns 349ns 0.0594 0 0 4.28 KB
#6385 EnrichedLog netcoreapp3.1 123μs 180ns 674ns 0 0 0 4.28 KB
#6385 EnrichedLog net472 151μs 96.3ns 373ns 0.678 0.226 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 3.03μs 0.858ns 3.32ns 0.0304 0 0 2.2 KB
master EnrichedLog netcoreapp3.1 4.21μs 1.92ns 7.43ns 0.0292 0 0 2.2 KB
master EnrichedLog net472 4.85μs 1.37ns 5.3ns 0.32 0 0 2.02 KB
#6385 EnrichedLog net6.0 3.05μs 0.787ns 2.95ns 0.0304 0 0 2.2 KB
#6385 EnrichedLog netcoreapp3.1 4.11μs 1.71ns 6.62ns 0.0288 0 0 2.2 KB
#6385 EnrichedLog net472 4.85μs 1.31ns 5.06ns 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.45μs 1.63ns 6.32ns 0.0158 0 0 1.14 KB
master SendReceive netcoreapp3.1 1.77μs 0.828ns 3.21ns 0.0159 0 0 1.14 KB
master SendReceive net472 2.1μs 1.75ns 6.79ns 0.183 0 0 1.16 KB
#6385 SendReceive net6.0 1.34μs 0.659ns 2.55ns 0.0161 0 0 1.14 KB
#6385 SendReceive netcoreapp3.1 1.74μs 0.844ns 3.27ns 0.0157 0 0 1.14 KB
#6385 SendReceive net472 2.05μs 1.35ns 5.21ns 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.74μs 1.38ns 5.35ns 0.022 0 0 1.6 KB
master EnrichedLog netcoreapp3.1 3.94μs 1.3ns 4.87ns 0.0215 0 0 1.65 KB
master EnrichedLog net472 4.49μs 3.15ns 12.2ns 0.322 0 0 2.04 KB
#6385 EnrichedLog net6.0 2.76μs 1.15ns 4.46ns 0.022 0 0 1.6 KB
#6385 EnrichedLog netcoreapp3.1 3.87μs 5.31ns 20.6ns 0.0214 0 0 1.65 KB
#6385 EnrichedLog net472 4.49μs 3.58ns 13.9ns 0.323 0 0 2.04 KB
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #6385

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 1.148 394.77 453.37

Faster 🎉 in #6385

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 1.269 636.90 501.83

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 394ns 0.665ns 2.58ns 0.00808 0 0 576 B
master StartFinishSpan netcoreapp3.1 607ns 1.15ns 4.44ns 0.00778 0 0 576 B
master StartFinishSpan net472 629ns 1.58ns 6.1ns 0.0916 0 0 578 B
master StartFinishScope net6.0 636ns 1.09ns 4.24ns 0.00957 0 0 696 B
master StartFinishScope netcoreapp3.1 689ns 1.02ns 3.97ns 0.00941 0 0 696 B
master StartFinishScope net472 901ns 3.72ns 14.4ns 0.104 0 0 658 B
#6385 StartFinishSpan net6.0 454ns 0.61ns 2.36ns 0.00804 0 0 576 B
#6385 StartFinishSpan netcoreapp3.1 587ns 0.605ns 2.34ns 0.0078 0 0 576 B
#6385 StartFinishSpan net472 642ns 1.63ns 6.32ns 0.0915 0 0 578 B
#6385 StartFinishScope net6.0 502ns 0.353ns 1.37ns 0.00975 0 0 696 B
#6385 StartFinishScope netcoreapp3.1 759ns 1.22ns 4.73ns 0.00922 0 0 696 B
#6385 StartFinishScope net472 878ns 2.14ns 8.28ns 0.105 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 648ns 1.7ns 6.6ns 0.00959 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 946ns 3.99ns 15.4ns 0.00904 0 0 696 B
master RunOnMethodBegin net472 1.12μs 1.06ns 3.95ns 0.104 0 0 658 B
#6385 RunOnMethodBegin net6.0 608ns 0.731ns 2.83ns 0.00982 0 0 696 B
#6385 RunOnMethodBegin netcoreapp3.1 948ns 1.42ns 5.51ns 0.00946 0 0 696 B
#6385 RunOnMethodBegin net472 1.17μs 2.39ns 8.93ns 0.104 0 0 658 B

andrewlock added a commit that referenced this pull request Dec 5, 2024
## Summary of changes

- Delete the tracer settings snapshot source generator
- Delete the snapshot objects

## Reason for change

We used these for tracking when customers use config in code so we know
which properties they're changing. However, in v3 we explicitly set the
values ourselves in the `ConfigureIntegration` so we may as well do all
the work there

## Implementation details

- Delete the source generator
- Delete usages of `[GenerateSnapshot]`, `[IgnoreForSnapshot]`, and
`[ConfigKey]`
- Delete `TracerSettingsSnapshot` and associated files and usages
- Record config changes in `ConfigureIntegration`

## Test coverage

Added a simple basic assertion to the manual instrumentation tests to
assert that we're still recording the `code` origin

## Other details

This is step 1 of a whole load of post-v3 code cleanup 😄 

- #6370 👈 This PR
- #6376
- #6385
- #6386
- #6397
- #6399
@andrewlock andrewlock force-pushed the andrew/remove-old-public-apis branch from ec58e9e to 9c080e2 Compare December 5, 2024 09:51
@andrewlock andrewlock requested review from a team as code owners December 5, 2024 09:51
@andrewlock andrewlock force-pushed the andrew/remove-public-api-tests branch from 09408bc to fb1c403 Compare December 5, 2024 09:53
@andrewlock
Copy link
Member Author

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 (6385) (11.242M)   : 0, 11241548
    master (11.222M)   : 0, 11221800
    benchmarks/2.9.0 (11.033M)   : 0, 11032866

    section Automatic
    This PR (6385) (7.268M)   : 0, 7268126
    master (7.306M)   : 0, 7305807
    benchmarks/2.9.0 (7.786M)   : 0, 7785853

    section Trace stats
    master (7.621M)   : 0, 7620774

    section Manual
    master (11.257M)   : 0, 11257171

    section Manual + Automatic
    This PR (6385) (6.722M)   : 0, 6721867
    master (6.783M)   : 0, 6782564

    section DD_TRACE_ENABLED=0
    master (10.363M)   : 0, 10362594

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6385) (9.694M)   : 0, 9693844
    master (9.664M)   : 0, 9664098
    benchmarks/2.9.0 (9.495M)   : 0, 9494821

    section Automatic
    This PR (6385) (6.447M)   : 0, 6447249
    master (6.272M)   : 0, 6271501

    section Trace stats
    master (6.601M)   : 0, 6601213

    section Manual
    master (9.639M)   : 0, 9638684

    section Manual + Automatic
    This PR (6385) (5.952M)   : 0, 5951940
    master (5.996M)   : 0, 5996086

    section DD_TRACE_ENABLED=0
    master (8.743M)   : 0, 8742779

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (6385) (9.835M)   : 0, 9835150
    master (10.051M)   : 0, 10050841
    benchmarks/2.9.0 (10.020M)   : 0, 10019592

    section Automatic
    This PR (6385) (6.247M)   : 0, 6247214
    master (6.245M)   : 0, 6245212
    benchmarks/2.9.0 (7.255M)   : 0, 7255257

    section Trace stats
    master (7.094M)   : 0, 7093813

    section Manual
    master (9.987M)   : 0, 9987436

    section Manual + Automatic
    This PR (6385) (5.811M)   : 0, 5811303
    master (5.990M)   : 0, 5990374

    section DD_TRACE_ENABLED=0
    master (9.233M)   : 0, 9232530

Loading

andrewlock added a commit that referenced this pull request Dec 6, 2024
## Summary of changes

Delete the Public API Generator

## Reason for change

We added this generator to reduce the amount of boilerplate you need to
write to correctly record telemetry for public APIs. However, with the
move to Datadog.Trace.Manual, these APIs are completely unused, so we
may as well remove the complexity and duplication.

## Implementation details

- Delete the `[GeneratePublicApi]` generator
- Keeping the `[PublicApi]` attribute for now - that will be cleared up
in a separate PR
- Rename the previously-decorated properties that _were_ called
`SomePropInternal` to `SomeProp`
- We still have some "leftover" `Internal` suffixes, will tidy those up
separately
- Main changes are in `TracerSettings`, `ExporterSettings`,
`IntegrationSettings` + their immutable counterparts

## Test coverage

Covered by existing tests

## Other details

I noticed that there were some properties that we were getting public
API telemetry for which we kind of lost in the move to
Datadog.Trace.Manual: `SpanContext.Parent`, `SpanContext.ParentId`,
`SpanContext.ServiceName`. I don't _think_ that actually matters, as
these can't actually be accessed any more for technical reasons...

Part of stack 
- #6370
- #6376 👈 This PR
- #6385
- #6386
- #6397
- #6399
- #6405
Base automatically changed from andrew/remove-old-public-apis to master December 6, 2024 11:48
@andrewlock andrewlock force-pushed the andrew/remove-public-api-tests branch from 964d182 to 8afed3b Compare December 6, 2024 11:49
@andrewlock andrewlock merged commit 4b802a8 into master Dec 6, 2024
101 of 104 checks passed
@andrewlock andrewlock deleted the andrew/remove-public-api-tests branch December 6, 2024 14:08
@github-actions github-actions bot added this to the vNext-v3 milestone Dec 6, 2024
andrewlock added a commit that referenced this pull request Dec 6, 2024
## Summary of changes

- Delete legacy `IConfigurationSource`
- Rename `ITelmeteredConfigurationSource` => `IConfigurationSource`
- Remove some "public" API workarounds
- Make some APIs `public` instead of `internal` (just to satisfy
compiler)
- Fix tests

## Reason for change

`ITelmeteredConfigurationSource` was introduced when
`IConfigurationSource` was public, and so could not be changed. We have
since removed that interface from the public API (it's not in
`Datadog.trace.Manual`) so now it simply adds confusion and complexity
(as it should _not_ be used internally in Datadog.Trace).

## Implementation details

This PR looks more complex than it is, because in order to replace all
the usages of the old `IConfigurationSource` with the new one, I had to
mark some other APIs public (and document them to satisfy the
analyzers).

It is mostly

- Delete legacy `IConfigurationSource`
- Rename `ITelmeteredConfigurationSource` => `IConfigurationSource`
- Fix any errors

I took the opportunity to also remove some of the `*Internal` methods
which were used to avoid calling the "public" APIs; seeing as these
aren't _actually_ public any more, that's just unnecessary duplication.

## Test coverage

The testing was a pain. The `ConfigurationBuilder` tests were all
designed to check that `ITelmeteredConfigurationSource` gave the same
results as `IConfigurationSource` (while never _explicitly_ specifying
what the "expected" behaviour was. I took some time to enumerate the
_actual_ expected values for the `NameValueCollection` source, but the
`Json` source has very different behaviour that is more of a pain to
test, so I chose to simplify a lot there. We could do a _lot_ to clean
up those tests, but I didn't want to add even more complexity in this
PR.

## Other details

To help "fix" the ASM tests I introduced a
`DictionaryObjectConfigurationSource`, in which you pass in a
`Dictionary<string, object>`. This is useful for testing (as it was
previously used) but is actually going to be useful for a future
clean-up PR too, so I kept it in Datadog.Trace instead of in the test
project.

Part of stack 
- #6370
- #6376
- #6385
- #6386 👈 This PR
- #6397
- #6399
- #6400
- #6405
- #6408
andrewlock added a commit that referenced this pull request Dec 9, 2024
…nSource` (#6397)

Change how we "apply" settings from manual configuration to the
automatic side to use `IConfigurationSource`

## Reason for change

The previous design of how we "apply" settings made in code using manual
instrumentation required mutating a `TracerSettings` object after it was
already built. In fact, this is pretty much the _only_ place that we
mutate the settings.

By switching to using a "configuration source" approach, so that the
settings are built _once_ with the correct values opens up the option to
make these immutable (and therefore delete all of the `Immutable*`
settings we currently have. This reduces both code duplication and work
we do on startup, and opens the path to further refactoring
improvements.

Note that the public API does not change, so consumers of
Datadog.Trace.Manual are still working with a mutable object initially.

## Implementation details

Currently we pass a `Dictionary<string, object>` between the manual and
automatic side. Previously, we then iterated the keys, compared against
known values, and modified `TracerSettings` as required.

With the changes, we have a `ManualInstrumentationConfigurationSource`
which just "wraps" the `Dictionary<>`, and returns the correct value as
required for a given key. Overall, I think this is much cleaner.

Where things get messy is how we handle disabling specific integrations.
The existing dictionary is optimised for looping through the provided
values, fetching the setting that needs to be modified, and changing all
the required properties. Unfortunately, the `IConfigurationSource`
approach where we're looking up by a key like `DD_TRACE_NPGSQL_ENABLED`
works _horribly_ for this pattern 🙁. So I introduced an additional
approach which explicitly _additionally_ transfers the settings using
these values, making them just "standard" lookups.

> Note that due to backwards + forwards compatibility requirements
> - We _still_ need to send the "old" version of integration settings
from the manual side, in case it's used with an old version of the auto
instrumentation
> - We _still_ need to handle the "old" version of integration settings
in the auto side, in case it's used with an old version of the manual
instrumentation.
> - At least in this case we can use the more efficient
`IConfigurationSource` reader, so we don't pay the expense of retrieving
the settings. The only downside is a couple of extra allocations when
they _do_ disable integrations in code.


Minor other changes:
- Add helper ctor to `CompositeConfigurationSource` for creating the
internal list from a collection of `IConfigurationSource`
- Tweak `DictionaryObjectConfigurationSource` so we can derive from it
- Create a separate integration for <3.7.0 manual instrumentation that
uses the legacy settings, otherwise use the new settings objects

## Test coverage

Mostly covered by existing unit tests (and indirectly by integration
tests). Tweaked the test to test both the new and legacy configuration
source.

## Other details

Requires #6393 to fix how
we read integration settings


Part of stack 
- #6370
- #6376
- #6385
- #6386
- #6397 👈 This PR
- #6399
- #6400
- #6405
- #6408
andrewlock added a commit that referenced this pull request Dec 9, 2024
…tead of mutating (#6399)

## Summary of changes

Change how CI Visibility creates its `TracerSettings` object to avoid
mutating settings afterwards

## Reason for change

This stack of changes is about removing duplication (among other things)
in the `TracerSettings` etc related objects. This is _partially_
required in order to remove the "snapshot generator" complexity that was
removed in #6370. Given
`TracerSettings` are not exposed publicly in Datadog.Trace, we want to
move to doing a "one shot" configuring of them, ultimately so that we
can make the object immutable (and remove `ImmutableTracerSettings` and
friends).

## Implementation details

CI Visibility is one of the few places where we mutate settings _after_
creating the `TracerSettings`. This is mostly because there's additional
logic that CI Visibility wants to perform.

Ultimately, the "solution" to that issue in this PR is to move that
logic into the `TracerSettings` constructor. I'm not entirely happy
about it, but it's the only approach I could find that works.

- Add a "dummy" configuration value to a configuration source when
creating the `TracerSettings`. This is used purely as a "switch" to say
"we're in CI Visibility mode".
- We absolutely could just pass this in as a constructor parameter. I
went that route first and then backed away, but can totally be swayed.
- Add an additional configuration source to update settings that we want
to change in CI Vis (e.g. logs injection).
- In the `TracerSettings` ctor, add an additional ignored URL when in CI
Vis mode, modify the default service name (if required) and add an
additional GlobalTag.

## Test coverage

I'd love to have some, but the CI Visibility configuration is kinda all
over the place, so if you have any pointers @tonyredondo I'm all ears...

## Other details

Part of stack 
- #6370
- #6376
- #6385
- #6386
- #6397 
- #6399 👈 This PR
- #6400  
- #6405
- #6408
andrewlock added a commit that referenced this pull request Dec 10, 2024
…utableDirectLogSubmissionSettings` (#6400)

## Summary of changes

Merge `DirectLogSubmissionSettings` with
`ImmutableDirectLogSubmissionSettings`

## Reason for change

There was never really a good reason for having these as separate types.
It was primarily to make testing a little easier and to mirror the
`TracerSettings`/`ImmutableTracerSettings` dichotomy, but as that's
going away, this is just unnecessary complexity

## Implementation details

- Moved the additional logic that was previously inside
`ImmutableDirectLogSubmissionSettings` into
`DirectLogSubmissionSettings`
- Renamed the `DirectLogSubmissionSettings` properties to match the
"Immutable" version (and remove the unnecessary prefix)
- Replace all usages of `Immutable*` with `DirectLogSubmissionSettings`
- Move `Immutable*Tests` into appropriate file and tweak
- Replace mutations with initialization (using `IConfigurationSource`)

## Test coverage

Essentially the same. I removed/tweaked some tests that are no longer
relevant

## Other details

Part of stack

- #6370
- #6376
- #6385
- #6386
- #6397 
- #6399
- #6400  👈 This PR
- #6405
- #6408
- #6415
andrewlock added a commit that referenced this pull request Dec 11, 2024
…tegrationSettings` (#6405)

## Summary of changes

Merge `IntegrationSettings` with `ImmutableIntegrationSettings`

## Reason for change

This stack of PRs is about doing one-shot configuration instead of
mutation. We never mutate these in the tracer after creation, so there's
no need for the separate types.

## Implementation details

- Moved additional logic (handling `DisabledNames` that was previously
inside `ImmutableIntegrationSettings` into `IntegrationSettings`
- Replace all usages of `Immutable*` with `IntegrationSettings`
- Move `Immutable*Tests` into appropriate file and tweak
- Replace mutations with initialization
- Reorder initialization of `DisabledIntegrationNames` in
`TracerSettings` so that it can be used in the `IntegrationSettings`
constructor

## Test coverage

All covered by existing details

## Other details

Part of Stack
- #6370
- #6376
- #6385
- #6386
- #6397 
- #6399
- #6400
- #6405 👈 This PR
- #6408
- #6415
andrewlock added a commit that referenced this pull request Dec 11, 2024
…terSettings` (#6408)

## Summary of changes

Merge `ExporterSettings` with `ImmutableExporterSettings`

## Reason for change

This stack of PRs is about doing one-shot configuration instead of
mutation. We never mutate these in the tracer after creation, so there's
no need for the separate types.

## Implementation details

- Made the properties in `ExporterSettings` get-only. This required
quite a lot of work because we were doing a lot of mutating of the
settings in the "helper" functions.
- I only _lightly_ refactored those methods (as much as possible) to
avoid setting the properties in the functions and instead returning the
details to set later.
- These are prime candidates for some _much_ heavier refactoring later,
but I didn't want to get bogged down with that in this PR
- Replace all usages of `Immutable*` with `ExporterSettings`
- Replace usages of `AgentUriInternal` with `AgentUri`
- Move `Immutable*Tests` into appropriate file and tweak
- Replace mutations with initialization

## Test coverage

All covered by existing details

## Other details

Part of Stack
- #6370
- #6376
- #6385
- #6386
- #6397 
- #6399
- #6400
- #6405
- #6408 👈 This PR
- #6415
andrewlock added a commit that referenced this pull request Dec 12, 2024
…ettings` (#6415)

## Summary of changes

Merge `TracerSettings` with `ImmutableTracerSettings`

## Reason for change

This stack of PRs is about doing one-shot configuration instead of
mutation. We never mutate these in the tracer after creation, so there's
no need for the separate types.

## Implementation details

- Make the properties in `TracerSettings` get-only. 
- Make the collections in `TracerSettings` readonly.
- Move logic that used to be in the constructor of
`ImmutableTracerSettings` into `TracerSettings`
- e.g. Service/Version/Env were being changed based on DD_TAGS values.
Moved that to TracerSettings and (importantly) added missing telemetry
recording of these values.
  - Added missing recording of _effective_ `DisabledInstegrations`
- Moving this logic caused some _tests_ to be broken (checking default
values). Updated the expected values of those tests in a single
- Replace all usages of `ImmutableTracerSettings` with `TracerSettings`
- Move `ITracer` to Datadog.Trace.Manual
- It's only used there, and references the manual-version of
`ImmutableTracerSettings` which we _want_ to keep.
- Move `Immutable*Tests` into appropriate file and tweak
- Replace mutations with initialization in tests

## Test coverage

All covered by existing tests (I hope) 🤞 

## Other details

There's still a _lot_ of scope to improve this 

Part of Stack
- #6370
- #6376
- #6385
- #6386
- #6397 
- #6399
- #6400
- #6405
- #6408
- #6415 👈 This PR
veerbia pushed a commit that referenced this pull request Dec 16, 2024
## Summary of changes

- Delete the tracer settings snapshot source generator
- Delete the snapshot objects

## Reason for change

We used these for tracking when customers use config in code so we know
which properties they're changing. However, in v3 we explicitly set the
values ourselves in the `ConfigureIntegration` so we may as well do all
the work there

## Implementation details

- Delete the source generator
- Delete usages of `[GenerateSnapshot]`, `[IgnoreForSnapshot]`, and
`[ConfigKey]`
- Delete `TracerSettingsSnapshot` and associated files and usages
- Record config changes in `ConfigureIntegration`

## Test coverage

Added a simple basic assertion to the manual instrumentation tests to
assert that we're still recording the `code` origin

## Other details

This is step 1 of a whole load of post-v3 code cleanup 😄 

- #6370 👈 This PR
- #6376
- #6385
- #6386
- #6397
- #6399
veerbia pushed a commit that referenced this pull request Dec 16, 2024
## Summary of changes

Delete the Public API Generator

## Reason for change

We added this generator to reduce the amount of boilerplate you need to
write to correctly record telemetry for public APIs. However, with the
move to Datadog.Trace.Manual, these APIs are completely unused, so we
may as well remove the complexity and duplication.

## Implementation details

- Delete the `[GeneratePublicApi]` generator
- Keeping the `[PublicApi]` attribute for now - that will be cleared up
in a separate PR
- Rename the previously-decorated properties that _were_ called
`SomePropInternal` to `SomeProp`
- We still have some "leftover" `Internal` suffixes, will tidy those up
separately
- Main changes are in `TracerSettings`, `ExporterSettings`,
`IntegrationSettings` + their immutable counterparts

## Test coverage

Covered by existing tests

## Other details

I noticed that there were some properties that we were getting public
API telemetry for which we kind of lost in the move to
Datadog.Trace.Manual: `SpanContext.Parent`, `SpanContext.ParentId`,
`SpanContext.ServiceName`. I don't _think_ that actually matters, as
these can't actually be accessed any more for technical reasons...

Part of stack 
- #6370
- #6376 👈 This PR
- #6385
- #6386
- #6397
- #6399
- #6405
veerbia pushed a commit that referenced this pull request Dec 16, 2024
…6385)

## Summary of changes

Remove `PublicApiTests.PublicApiHasNotChanged` for Datadog.Trace.dll

## Reason for change

The public API surface of Datadog.Trace is not _really_ public any more,
as it's not directly referenced, so these tests are largely
unneccessary.

As of right now, `public` vs `internal` is essentially irrelevant in
this project.

## Implementation details

Remove the `PublicApiHasNotChanged` test. The other public API tests
e.g. `AssemblyReferencesHaveNotChanged` _are_ still relevant, so jumped
through some hoops to keep them

## Test coverage

Slightly less now.

## Other details

Part of stack 

- #6370
- #6376
- #6385 👈 This PR
- #6386
- #6397
- #6399
- #6400
- #6405
veerbia pushed a commit that referenced this pull request Dec 16, 2024
## Summary of changes

- Delete legacy `IConfigurationSource`
- Rename `ITelmeteredConfigurationSource` => `IConfigurationSource`
- Remove some "public" API workarounds
- Make some APIs `public` instead of `internal` (just to satisfy
compiler)
- Fix tests

## Reason for change

`ITelmeteredConfigurationSource` was introduced when
`IConfigurationSource` was public, and so could not be changed. We have
since removed that interface from the public API (it's not in
`Datadog.trace.Manual`) so now it simply adds confusion and complexity
(as it should _not_ be used internally in Datadog.Trace).

## Implementation details

This PR looks more complex than it is, because in order to replace all
the usages of the old `IConfigurationSource` with the new one, I had to
mark some other APIs public (and document them to satisfy the
analyzers).

It is mostly

- Delete legacy `IConfigurationSource`
- Rename `ITelmeteredConfigurationSource` => `IConfigurationSource`
- Fix any errors

I took the opportunity to also remove some of the `*Internal` methods
which were used to avoid calling the "public" APIs; seeing as these
aren't _actually_ public any more, that's just unnecessary duplication.

## Test coverage

The testing was a pain. The `ConfigurationBuilder` tests were all
designed to check that `ITelmeteredConfigurationSource` gave the same
results as `IConfigurationSource` (while never _explicitly_ specifying
what the "expected" behaviour was. I took some time to enumerate the
_actual_ expected values for the `NameValueCollection` source, but the
`Json` source has very different behaviour that is more of a pain to
test, so I chose to simplify a lot there. We could do a _lot_ to clean
up those tests, but I didn't want to add even more complexity in this
PR.

## Other details

To help "fix" the ASM tests I introduced a
`DictionaryObjectConfigurationSource`, in which you pass in a
`Dictionary<string, object>`. This is useful for testing (as it was
previously used) but is actually going to be useful for a future
clean-up PR too, so I kept it in Datadog.Trace instead of in the test
project.

Part of stack 
- #6370
- #6376
- #6385
- #6386 👈 This PR
- #6397
- #6399
- #6400
- #6405
- #6408
veerbia pushed a commit that referenced this pull request Dec 16, 2024
…nSource` (#6397)

Change how we "apply" settings from manual configuration to the
automatic side to use `IConfigurationSource`

## Reason for change

The previous design of how we "apply" settings made in code using manual
instrumentation required mutating a `TracerSettings` object after it was
already built. In fact, this is pretty much the _only_ place that we
mutate the settings.

By switching to using a "configuration source" approach, so that the
settings are built _once_ with the correct values opens up the option to
make these immutable (and therefore delete all of the `Immutable*`
settings we currently have. This reduces both code duplication and work
we do on startup, and opens the path to further refactoring
improvements.

Note that the public API does not change, so consumers of
Datadog.Trace.Manual are still working with a mutable object initially.

## Implementation details

Currently we pass a `Dictionary<string, object>` between the manual and
automatic side. Previously, we then iterated the keys, compared against
known values, and modified `TracerSettings` as required.

With the changes, we have a `ManualInstrumentationConfigurationSource`
which just "wraps" the `Dictionary<>`, and returns the correct value as
required for a given key. Overall, I think this is much cleaner.

Where things get messy is how we handle disabling specific integrations.
The existing dictionary is optimised for looping through the provided
values, fetching the setting that needs to be modified, and changing all
the required properties. Unfortunately, the `IConfigurationSource`
approach where we're looking up by a key like `DD_TRACE_NPGSQL_ENABLED`
works _horribly_ for this pattern 🙁. So I introduced an additional
approach which explicitly _additionally_ transfers the settings using
these values, making them just "standard" lookups.

> Note that due to backwards + forwards compatibility requirements
> - We _still_ need to send the "old" version of integration settings
from the manual side, in case it's used with an old version of the auto
instrumentation
> - We _still_ need to handle the "old" version of integration settings
in the auto side, in case it's used with an old version of the manual
instrumentation.
> - At least in this case we can use the more efficient
`IConfigurationSource` reader, so we don't pay the expense of retrieving
the settings. The only downside is a couple of extra allocations when
they _do_ disable integrations in code.


Minor other changes:
- Add helper ctor to `CompositeConfigurationSource` for creating the
internal list from a collection of `IConfigurationSource`
- Tweak `DictionaryObjectConfigurationSource` so we can derive from it
- Create a separate integration for <3.7.0 manual instrumentation that
uses the legacy settings, otherwise use the new settings objects

## Test coverage

Mostly covered by existing unit tests (and indirectly by integration
tests). Tweaked the test to test both the new and legacy configuration
source.

## Other details

Requires #6393 to fix how
we read integration settings


Part of stack 
- #6370
- #6376
- #6385
- #6386
- #6397 👈 This PR
- #6399
- #6400
- #6405
- #6408
veerbia pushed a commit that referenced this pull request Dec 16, 2024
…tead of mutating (#6399)

## Summary of changes

Change how CI Visibility creates its `TracerSettings` object to avoid
mutating settings afterwards

## Reason for change

This stack of changes is about removing duplication (among other things)
in the `TracerSettings` etc related objects. This is _partially_
required in order to remove the "snapshot generator" complexity that was
removed in #6370. Given
`TracerSettings` are not exposed publicly in Datadog.Trace, we want to
move to doing a "one shot" configuring of them, ultimately so that we
can make the object immutable (and remove `ImmutableTracerSettings` and
friends).

## Implementation details

CI Visibility is one of the few places where we mutate settings _after_
creating the `TracerSettings`. This is mostly because there's additional
logic that CI Visibility wants to perform.

Ultimately, the "solution" to that issue in this PR is to move that
logic into the `TracerSettings` constructor. I'm not entirely happy
about it, but it's the only approach I could find that works.

- Add a "dummy" configuration value to a configuration source when
creating the `TracerSettings`. This is used purely as a "switch" to say
"we're in CI Visibility mode".
- We absolutely could just pass this in as a constructor parameter. I
went that route first and then backed away, but can totally be swayed.
- Add an additional configuration source to update settings that we want
to change in CI Vis (e.g. logs injection).
- In the `TracerSettings` ctor, add an additional ignored URL when in CI
Vis mode, modify the default service name (if required) and add an
additional GlobalTag.

## Test coverage

I'd love to have some, but the CI Visibility configuration is kinda all
over the place, so if you have any pointers @tonyredondo I'm all ears...

## Other details

Part of stack 
- #6370
- #6376
- #6385
- #6386
- #6397 
- #6399 👈 This PR
- #6400  
- #6405
- #6408
veerbia pushed a commit that referenced this pull request Dec 16, 2024
…utableDirectLogSubmissionSettings` (#6400)

## Summary of changes

Merge `DirectLogSubmissionSettings` with
`ImmutableDirectLogSubmissionSettings`

## Reason for change

There was never really a good reason for having these as separate types.
It was primarily to make testing a little easier and to mirror the
`TracerSettings`/`ImmutableTracerSettings` dichotomy, but as that's
going away, this is just unnecessary complexity

## Implementation details

- Moved the additional logic that was previously inside
`ImmutableDirectLogSubmissionSettings` into
`DirectLogSubmissionSettings`
- Renamed the `DirectLogSubmissionSettings` properties to match the
"Immutable" version (and remove the unnecessary prefix)
- Replace all usages of `Immutable*` with `DirectLogSubmissionSettings`
- Move `Immutable*Tests` into appropriate file and tweak
- Replace mutations with initialization (using `IConfigurationSource`)

## Test coverage

Essentially the same. I removed/tweaked some tests that are no longer
relevant

## Other details

Part of stack

- #6370
- #6376
- #6385
- #6386
- #6397 
- #6399
- #6400  👈 This PR
- #6405
- #6408
- #6415
veerbia pushed a commit that referenced this pull request Dec 16, 2024
…tegrationSettings` (#6405)

## Summary of changes

Merge `IntegrationSettings` with `ImmutableIntegrationSettings`

## Reason for change

This stack of PRs is about doing one-shot configuration instead of
mutation. We never mutate these in the tracer after creation, so there's
no need for the separate types.

## Implementation details

- Moved additional logic (handling `DisabledNames` that was previously
inside `ImmutableIntegrationSettings` into `IntegrationSettings`
- Replace all usages of `Immutable*` with `IntegrationSettings`
- Move `Immutable*Tests` into appropriate file and tweak
- Replace mutations with initialization
- Reorder initialization of `DisabledIntegrationNames` in
`TracerSettings` so that it can be used in the `IntegrationSettings`
constructor

## Test coverage

All covered by existing details

## Other details

Part of Stack
- #6370
- #6376
- #6385
- #6386
- #6397 
- #6399
- #6400
- #6405 👈 This PR
- #6408
- #6415
veerbia pushed a commit that referenced this pull request Dec 16, 2024
…terSettings` (#6408)

## Summary of changes

Merge `ExporterSettings` with `ImmutableExporterSettings`

## Reason for change

This stack of PRs is about doing one-shot configuration instead of
mutation. We never mutate these in the tracer after creation, so there's
no need for the separate types.

## Implementation details

- Made the properties in `ExporterSettings` get-only. This required
quite a lot of work because we were doing a lot of mutating of the
settings in the "helper" functions.
- I only _lightly_ refactored those methods (as much as possible) to
avoid setting the properties in the functions and instead returning the
details to set later.
- These are prime candidates for some _much_ heavier refactoring later,
but I didn't want to get bogged down with that in this PR
- Replace all usages of `Immutable*` with `ExporterSettings`
- Replace usages of `AgentUriInternal` with `AgentUri`
- Move `Immutable*Tests` into appropriate file and tweak
- Replace mutations with initialization

## Test coverage

All covered by existing details

## Other details

Part of Stack
- #6370
- #6376
- #6385
- #6386
- #6397 
- #6399
- #6400
- #6405
- #6408 👈 This PR
- #6415
veerbia pushed a commit that referenced this pull request Dec 16, 2024
…ettings` (#6415)

Merge `TracerSettings` with `ImmutableTracerSettings`

This stack of PRs is about doing one-shot configuration instead of
mutation. We never mutate these in the tracer after creation, so there's
no need for the separate types.

- Make the properties in `TracerSettings` get-only.
- Make the collections in `TracerSettings` readonly.
- Move logic that used to be in the constructor of
`ImmutableTracerSettings` into `TracerSettings`
- e.g. Service/Version/Env were being changed based on DD_TAGS values.
Moved that to TracerSettings and (importantly) added missing telemetry
recording of these values.
  - Added missing recording of _effective_ `DisabledInstegrations`
- Moving this logic caused some _tests_ to be broken (checking default
values). Updated the expected values of those tests in a single
- Replace all usages of `ImmutableTracerSettings` with `TracerSettings`
- Move `ITracer` to Datadog.Trace.Manual
- It's only used there, and references the manual-version of
`ImmutableTracerSettings` which we _want_ to keep.
- Move `Immutable*Tests` into appropriate file and tweak
- Replace mutations with initialization in tests

All covered by existing tests (I hope) 🤞

There's still a _lot_ of scope to improve this

Part of Stack
- #6370
- #6376
- #6385
- #6386
- #6397
- #6399
- #6400
- #6405
- #6408
- #6415 👈 This PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:tests unit tests, integration tests area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) type:cleanup Minor code clean up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants