dd-trace-dotnet icon indicating copy to clipboard operation
dd-trace-dotnet copied to clipboard

[Tracing] Unify the manual Tracer instance and the automatic Tracer instance - Part 1: Automatic Refactoring

Open zacharycmontoya opened this issue 2 years ago • 4 comments

Summary of changes

Moves the logic for the public property Tracer.Instance into the internal property Tracer.InternalInstance and refactors all internal usages to the internal property

Reason for change

In order to resolve version-conflict scenarios using automatic instrumentation, we intend to rewrite the bytecode of the public Tracer.Instance accessor. As a result, we must clearly identify which code paths are called from the manual API and which code paths are called internally. This refactoring accomplishes that and isolates the wide set of renames to just this PR, so follow-up PR's can focus on the automatic instrumentation and API changes.

Note: This change does not affect any public API's ✅

Implementation details

  • Adds the [PublicApi] attribute to Tracer.Instance, which causes compilation errors for internal uses inside Datadog.Trace
  • Adds a new internal Tracer.InternalInstance, which contains the previous Tracer.Instance logic
  • Redirect the public Tracer.Instance to get/set Tracer.InternalInstance
  • Change all internal usages from Tracer.Instance to Tracer.InternalInstance, except for the following cases:
    • CorrelationIdentifier API's, which are only used for manual logs injection
    • OpenTracingTracerFactory, which is only used from manual instrumentation with OpenTracing

Test coverage

Existing tests cover this

Other details

N/A

zacharycmontoya avatar Oct 03 '23 20:10 zacharycmontoya

Datadog Report

Branch report: zach/assembly-conflict-pt1 Commit report: 6cbe1cc

:white_check_mark: dd-trace-dotnet: 0 Failed, 0 New Flaky, 309465 Passed, 1423 Skipped, 22m 39.32s Wall Time

datadog-ddstaging[bot] avatar Oct 03 '23 21:10 datadog-ddstaging[bot]

Execution-Time Benchmarks Report :stopwatch:

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 (4686) - mean (76ms)  : 56, 97
     .   : milestone, 76,
    master - mean (75ms)  : 56, 94
     .   : milestone, 75,

    section CallTarget+Inlining+NGEN
    This PR (4686) - mean (1,037ms)  : 1022, 1053
     .   : milestone, 1037,
    master - mean (1,045ms)  : 1015, 1076
     .   : milestone, 1045,

gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4686) - mean (106ms)  : 101, 111
     .   : milestone, 106,
    master - mean (109ms)  : 97, 120
     .   : milestone, 109,

    section CallTarget+Inlining+NGEN
    This PR (4686) - mean (747ms)  : 731, 763
     .   : milestone, 747,
    master - mean (748ms)  : 720, 776
     .   : milestone, 748,

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

    section CallTarget+Inlining+NGEN
    This PR (4686) - mean (705ms)  : 686, 725
     .   : milestone, 705,
    master - mean (706ms)  : 685, 727
     .   : milestone, 706,

gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (4686) - mean (192ms)  : 188, 196
     .   : milestone, 192,
    master - mean (191ms)  : 189, 194
     .   : milestone, 191,

    section CallTarget+Inlining+NGEN
    This PR (4686) - mean (1,136ms)  : 1106, 1166
     .   : milestone, 1136,
    master - mean (1,137ms)  : 1104, 1170
     .   : milestone, 1137,

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

    section CallTarget+Inlining+NGEN
    This PR (4686) - mean (1,100ms)  : 1069, 1132
     .   : milestone, 1100,
    master - mean (1,104ms)  : 1073, 1135
     .   : milestone, 1104,

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

    section CallTarget+Inlining+NGEN
    This PR (4686) - mean (1,057ms)  : 1032, 1082
     .   : milestone, 1057,
    master - mean (1,061ms)  : 1028, 1094
     .   : milestone, 1061,

andrewlock avatar Oct 03 '23 22:10 andrewlock

Benchmarks Report :snail:

Benchmarks for #4686 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.119
  • 4 benchmarks are slower, with geometric mean 1.157
  • 1 benchmarks have fewer 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 :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 8.24μs 42.8ns 196ns 0.0204 0.00817 0 7.29 KB
master StartStopWithChild netcoreapp3.1 10.1μs 55.7ns 325ns 0.029 0.0145 0 7.38 KB
master StartStopWithChild net472 15.8μs 56.9ns 220ns 1.27 0.309 0.0927 7.67 KB
#4686 StartStopWithChild net6.0 8.05μs 43ns 227ns 0.0158 0.00788 0 7.29 KB
#4686 StartStopWithChild netcoreapp3.1 9.92μs 54.9ns 329ns 0.0282 0.0141 0 7.39 KB
#4686 StartStopWithChild net472 15.6μs 57.4ns 222ns 1.27 0.322 0.0996 7.66 KB
Benchmarks.Trace.AgentWriterBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 472μs 336ns 1.3μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 643μs 353ns 1.32μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 809μs 318ns 1.19μs 0.403 0 0 3.3 KB
#4686 WriteAndFlushEnrichedTraces net6.0 472μs 157ns 607ns 0 0 0 2.7 KB
#4686 WriteAndFlushEnrichedTraces netcoreapp3.1 634μs 284ns 1.02μs 0 0 0 2.7 KB
#4686 WriteAndFlushEnrichedTraces net472 806μs 325ns 1.26μs 0.403 0 0 3.3 KB
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 44.8μs 54.7ns 212ns 0.0223 0 0 2.03 KB
master AllCycleSimpleBody netcoreapp3.1 45.5μs 91.1ns 353ns 0.0226 0 0 2.01 KB
master AllCycleSimpleBody net472 46.5μs 9.77ns 35.2ns 0.321 0 0 2.08 KB
master AllCycleMoreComplexBody net6.0 230μs 87.3ns 315ns 0.115 0 0 8.63 KB
master AllCycleMoreComplexBody netcoreapp3.1 235μs 196ns 759ns 0 0 0 8.52 KB
master AllCycleMoreComplexBody net472 238μs 123ns 475ns 1.31 0 0 8.7 KB
master ObjectExtractorSimpleBody net6.0 120ns 0.0745ns 0.279ns 0.00394 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 179ns 0.105ns 0.395ns 0.00364 0 0 272 B
master ObjectExtractorSimpleBody net472 145ns 0.0919ns 0.356ns 0.0446 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 3.02μs 1.8ns 6.73ns 0.0545 0 0 3.88 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 4.13μs 2.48ns 8.93ns 0.0495 0 0 3.78 KB
master ObjectExtractorMoreComplexBody net472 4.24μs 1.77ns 6.61ns 0.617 0.00634 0 3.89 KB
#4686 AllCycleSimpleBody net6.0 43.7μs 38.4ns 149ns 0.0215 0 0 2.03 KB
#4686 AllCycleSimpleBody netcoreapp3.1 45.9μs 125ns 486ns 0.0232 0 0 2.01 KB
#4686 AllCycleSimpleBody net472 46.9μs 20.4ns 78.9ns 0.321 0 0 2.08 KB
#4686 AllCycleMoreComplexBody net6.0 230μs 89.3ns 346ns 0.116 0 0 8.63 KB
#4686 AllCycleMoreComplexBody netcoreapp3.1 237μs 91.8ns 344ns 0 0 0 8.52 KB
#4686 AllCycleMoreComplexBody net472 240μs 126ns 488ns 1.31 0 0 8.7 KB
#4686 ObjectExtractorSimpleBody net6.0 127ns 0.0933ns 0.361ns 0.00391 0 0 280 B
#4686 ObjectExtractorSimpleBody netcoreapp3.1 181ns 0.193ns 0.746ns 0.00371 0 0 272 B
#4686 ObjectExtractorSimpleBody net472 148ns 0.118ns 0.426ns 0.0446 0 0 281 B
#4686 ObjectExtractorMoreComplexBody net6.0 3.01μs 1.26ns 4.72ns 0.0542 0 0 3.88 KB
#4686 ObjectExtractorMoreComplexBody netcoreapp3.1 4.11μs 1.88ns 7.03ns 0.0514 0 0 3.78 KB
#4686 ObjectExtractorMoreComplexBody net472 4.2μs 2.59ns 9.68ns 0.618 0.00633 0 3.89 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWaf(args=NestedMap (10)) net6.0 12.8μs 2.37ns 8.55ns 0.133 0 0 9.42 KB
master RunWaf(args=NestedMap (10)) netcoreapp3.1 19.2μs 4.41ns 16.5ns 0.124 0 0 9.42 KB
master RunWaf(args=NestedMap (10)) net472 28.7μs 11.1ns 40ns 1.5 0 0 9.48 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 76.4μs 29.6ns 111ns 0.23 0 0 15.77 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 86.7μs 119ns 462ns 0.214 0 0 15.72 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 98.8μs 164ns 635ns 2.54 0 0 16.04 KB
master RunWaf(args=NestedMap (100)) net6.0 24.1μs 8.02ns 30ns 0.278 0 0 19.66 KB
master RunWaf(args=NestedMap (100)) netcoreapp3.1 37.9μs 20ns 74.8ns 0.265 0 0 20.42 KB
master RunWaf(args=NestedMap (100)) net472 54.2μs 21.9ns 84.7ns 3.27 0.0271 0 20.63 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 94.8μs 58.4ns 226ns 0.328 0 0 26.01 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 108μs 319ns 1.24μs 0.327 0 0 26.72 KB
master RunWafWithAttack(args=Neste(...)tack) [23]) net472 130μs 250ns 970ns 4.27 0.0657 0 27.19 KB
master RunWaf(args=NestedMap (20)) net6.0 24.1μs 6ns 22.5ns 0.276 0 0 19.4 KB
master RunWaf(args=NestedMap (20)) netcoreapp3.1 37.4μs 11.6ns 44.9ns 0.262 0 0 19.84 KB
master RunWaf(args=NestedMap (20)) net472 54.6μs 27.1ns 105ns 3.17 0.0547 0 20.04 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 93.6μs 55.7ns 216ns 0.328 0 0 25.74 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 108μs 184ns 714ns 0.324 0 0 26.14 KB
master RunWafWithAttack(args=Neste(...)tack) [22]) net472 130μs 158ns 611ns 4.2 0.0646 0 26.6 KB
#4686 RunWaf(args=NestedMap (10)) net6.0 12.7μs 4.2ns 16.3ns 0.133 0 0 9.42 KB
#4686 RunWaf(args=NestedMap (10)) netcoreapp3.1 19.4μs 5.39ns 20.9ns 0.126 0 0 9.42 KB
#4686 RunWaf(args=NestedMap (10)) net472 28.5μs 11.9ns 46.2ns 1.49 0 0 9.48 KB
#4686 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 76.7μs 67.5ns 261ns 0.19 0 0 15.77 KB
#4686 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 85.7μs 42.4ns 159ns 0.215 0 0 15.72 KB
#4686 RunWafWithAttack(args=Neste(...)tack) [22]) net472 97.6μs 82.3ns 297ns 2.55 0 0 16.04 KB
#4686 RunWaf(args=NestedMap (100)) net6.0 24.2μs 6.65ns 24ns 0.275 0 0 19.66 KB
#4686 RunWaf(args=NestedMap (100)) netcoreapp3.1 37.9μs 12.1ns 45.3ns 0.267 0 0 20.42 KB
#4686 RunWaf(args=NestedMap (100)) net472 53.9μs 24.8ns 96.1ns 3.26 0.027 0 20.63 KB
#4686 RunWafWithAttack(args=Neste(...)tack) [23]) net6.0 95.2μs 145ns 563ns 0.333 0 0 26.01 KB
#4686 RunWafWithAttack(args=Neste(...)tack) [23]) netcoreapp3.1 108μs 86.2ns 323ns 0.322 0 0 26.72 KB
#4686 RunWafWithAttack(args=Neste(...)tack) [23]) net472 131μs 281ns 1.09μs 4.29 0.065 0 27.19 KB
#4686 RunWaf(args=NestedMap (20)) net6.0 23.8μs 5.72ns 19.8ns 0.264 0 0 19.4 KB
#4686 RunWaf(args=NestedMap (20)) netcoreapp3.1 37.3μs 6.67ns 25ns 0.262 0 0 19.84 KB
#4686 RunWaf(args=NestedMap (20)) net472 53.9μs 12.7ns 45.9ns 3.17 0.0537 0 20.04 KB
#4686 RunWafWithAttack(args=Neste(...)tack) [22]) net6.0 91.9μs 93ns 348ns 0.324 0 0 25.74 KB
#4686 RunWafWithAttack(args=Neste(...)tack) [22]) netcoreapp3.1 108μs 60.5ns 226ns 0.324 0 0 26.14 KB
#4686 RunWafWithAttack(args=Neste(...)tack) [22]) net472 129μs 70.4ns 273ns 4.21 0.0647 0 26.6 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 169μs 161ns 625ns 0.253 0 0 18.09 KB
master SendRequest netcoreapp3.1 191μs 383ns 1.48μs 0.191 0 0 20.25 KB
master SendRequest net472 0.00196ns 0.000486ns 0.00175ns 0 0 0 0 b
#4686 SendRequest net6.0 168μs 119ns 459ns 0.168 0 0 18.09 KB
#4686 SendRequest netcoreapp3.1 187μs 217ns 841ns 0.185 0 0 20.25 KB
#4686 SendRequest net472 2.58E‑05ns 2.58E‑05ns 9.64E‑05ns 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed :heavy_check_mark: Fewer allocations :tada:

Fewer allocations :tada: in #4686

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 41.74 KB 41.51 KB -230 B -0.55%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 574μs 2.82μs 11.6μs 0.576 0 0 41.59 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 648μs 439ns 1.7μs 0.327 0 0 41.74 KB
master WriteAndFlushEnrichedTraces net472 817μs 4μs 17μs 8.08 2.55 0.425 53.25 KB
#4686 WriteAndFlushEnrichedTraces net6.0 541μs 1.65μs 6.38μs 0.527 0 0 41.52 KB
#4686 WriteAndFlushEnrichedTraces netcoreapp3.1 653μs 1.98μs 7.67μs 0.319 0 0 41.51 KB
#4686 WriteAndFlushEnrichedTraces net472 856μs 4.2μs 17.3μs 8.17 2.45 0.408 53.25 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.08μs 0.399ns 1.55ns 0.0109 0 0 768 B
master ExecuteNonQuery netcoreapp3.1 1.3μs 0.447ns 1.73ns 0.0106 0 0 768 B
master ExecuteNonQuery net472 1.6μs 0.989ns 3.7ns 0.116 0 0 730 B
#4686 ExecuteNonQuery net6.0 1.08μs 0.448ns 1.61ns 0.0108 0 0 768 B
#4686 ExecuteNonQuery netcoreapp3.1 1.33μs 0.592ns 2.29ns 0.0107 0 0 768 B
#4686 ExecuteNonQuery net472 1.63μs 1.85ns 6.69ns 0.116 0 0 730 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.24μs 0.909ns 3.4ns 0.0138 0 0 992 B
master CallElasticsearch netcoreapp3.1 1.54μs 1.8ns 6.75ns 0.0137 0 0 992 B
master CallElasticsearch net472 2.33μs 1.48ns 5.74ns 0.158 0 0 1 KB
master CallElasticsearchAsync net6.0 1.4μs 0.762ns 2.95ns 0.0138 0 0 968 B
master CallElasticsearchAsync netcoreapp3.1 1.55μs 0.737ns 2.76ns 0.0139 0 0 1.04 KB
master CallElasticsearchAsync net472 2.47μs 0.96ns 3.72ns 0.168 0 0 1.06 KB
#4686 CallElasticsearch net6.0 1.16μs 0.366ns 1.42ns 0.014 0 0 992 B
#4686 CallElasticsearch netcoreapp3.1 1.39μs 0.579ns 2.24ns 0.0134 0 0 992 B
#4686 CallElasticsearch net472 2.57μs 1.63ns 6.32ns 0.159 0 0 1 KB
#4686 CallElasticsearchAsync net6.0 1.31μs 0.725ns 2.81ns 0.0131 0 0 968 B
#4686 CallElasticsearchAsync netcoreapp3.1 1.54μs 0.47ns 1.76ns 0.0146 0 0 1.04 KB
#4686 CallElasticsearchAsync net472 2.55μs 1.75ns 6.76ns 0.167 0 0 1.06 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.09μs 0.338ns 1.31ns 0.0126 0 0 912 B
master ExecuteAsync netcoreapp3.1 1.37μs 0.446ns 1.73ns 0.0125 0 0 912 B
master ExecuteAsync net472 1.7μs 0.953ns 3.69ns 0.139 0 0 875 B
#4686 ExecuteAsync net6.0 1.21μs 0.68ns 2.54ns 0.0126 0 0 912 B
#4686 ExecuteAsync netcoreapp3.1 1.51μs 0.612ns 2.37ns 0.0121 0 0 912 B
#4686 ExecuteAsync net472 1.7μs 0.484ns 1.87ns 0.139 0 0 875 B
Benchmarks.Trace.HttpClientBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net6.0 3.86μs 0.98ns 3.67ns 0.027 0 0 1.94 KB
master SendAsync netcoreapp3.1 4.44μs 1.88ns 7.05ns 0.0334 0 0 2.48 KB
master SendAsync net472 7.14μs 2.29ns 8.55ns 0.482 0 0 3.05 KB
#4686 SendAsync net6.0 3.77μs 1.81ns 6.78ns 0.0265 0 0 1.94 KB
#4686 SendAsync netcoreapp3.1 4.41μs 1.29ns 4.82ns 0.033 0 0 2.48 KB
#4686 SendAsync net472 7.22μs 3.03ns 11.8ns 0.484 0 0 3.05 KB
Benchmarks.Trace.ILoggerBenchmark - Slower :warning: Same allocations :heavy_check_mark:

Slower :warning: in #4686

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑net6.0 1.157 1,255.74 1,453.31

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 1.26μs 0.454ns 1.7ns 0.0229 0 0 1.62 KB
master EnrichedLog netcoreapp3.1 2μs 0.709ns 2.56ns 0.0221 0 0 1.62 KB
master EnrichedLog net472 2.4μs 3.93ns 15.2ns 0.244 0 0 1.54 KB
#4686 EnrichedLog net6.0 1.45μs 0.569ns 2.13ns 0.0225 0 0 1.62 KB
#4686 EnrichedLog netcoreapp3.1 1.89μs 0.806ns 3.01ns 0.0226 0 0 1.62 KB
#4686 EnrichedLog net472 2.28μs 2.35ns 8.77ns 0.244 0 0 1.54 KB
Benchmarks.Trace.Log4netBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 111μs 134ns 518ns 0.0555 0 0 4.21 KB
master EnrichedLog netcoreapp3.1 120μs 127ns 491ns 0 0 0 4.21 KB
master EnrichedLog net472 150μs 49.8ns 193ns 0.675 0.225 0 4.38 KB
#4686 EnrichedLog net6.0 113μs 122ns 472ns 0.0559 0 0 4.21 KB
#4686 EnrichedLog netcoreapp3.1 120μs 116ns 450ns 0 0 0 4.21 KB
#4686 EnrichedLog net472 149μs 75.7ns 283ns 0.67 0.223 0 4.38 KB
Benchmarks.Trace.NLogBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.98μs 1.52ns 5.9ns 0.0299 0 0 2.18 KB
master EnrichedLog netcoreapp3.1 3.82μs 1.53ns 5.93ns 0.0286 0 0 2.18 KB
master EnrichedLog net472 4.55μs 1.64ns 6.34ns 0.315 0 0 1.99 KB
#4686 EnrichedLog net6.0 2.88μs 1.07ns 4.16ns 0.0301 0 0 2.18 KB
#4686 EnrichedLog netcoreapp3.1 3.83μs 1.73ns 6.46ns 0.029 0 0 2.18 KB
#4686 EnrichedLog net472 4.63μs 1.26ns 4.71ns 0.315 0 0 1.99 KB
Benchmarks.Trace.RedisBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 1.37μs 0.62ns 2.4ns 0.0164 0 0 1.16 KB
master SendReceive netcoreapp3.1 1.63μs 1.02ns 3.82ns 0.0154 0 0 1.16 KB
master SendReceive net472 1.99μs 2.17ns 8.4ns 0.185 0 0 1.16 KB
#4686 SendReceive net6.0 1.29μs 1.14ns 4.4ns 0.0162 0 0 1.16 KB
#4686 SendReceive netcoreapp3.1 1.6μs 0.88ns 3.41ns 0.016 0 0 1.16 KB
#4686 SendReceive net472 2.01μs 1.26ns 4.89ns 0.184 0 0 1.16 KB
Benchmarks.Trace.SerilogBenchmark - Same speed :heavy_check_mark: Same allocations :heavy_check_mark:

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.45μs 1.09ns 4.24ns 0.0209 0 0 1.53 KB
master EnrichedLog netcoreapp3.1 3.62μs 2.21ns 8.58ns 0.0216 0 0 1.58 KB
master EnrichedLog net472 3.97μs 1.25ns 4.83ns 0.311 0 0 1.96 KB
#4686 EnrichedLog net6.0 2.48μs 0.815ns 3.16ns 0.0211 0 0 1.53 KB
#4686 EnrichedLog netcoreapp3.1 3.67μs 1.71ns 6.39ns 0.022 0 0 1.58 KB
#4686 EnrichedLog net472 4.01μs 2.22ns 8.6ns 0.31 0 0 1.96 KB
Benchmarks.Trace.SpanBenchmark - Slower :warning: Same allocations :heavy_check_mark:

Slower :warning: in #4686

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 1.175 554.12 651.17
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 1.154 471.81 544.57
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑netcoreapp3.1 1.143 728.26 832.11

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 474ns 0.423ns 1.58ns 0.0076 0 0 536 B
master StartFinishSpan netcoreapp3.1 554ns 0.282ns 1.05ns 0.00722 0 0 536 B
master StartFinishSpan net472 624ns 0.175ns 0.656ns 0.0853 0 0 538 B
master StartFinishScope net6.0 472ns 0.127ns 0.477ns 0.00918 0 0 656 B
master StartFinishScope netcoreapp3.1 728ns 0.345ns 1.34ns 0.00886 0 0 656 B
master StartFinishScope net472 802ns 0.717ns 2.78ns 0.098 0 0 618 B
#4686 StartFinishSpan net6.0 458ns 0.16ns 0.62ns 0.00751 0 0 536 B
#4686 StartFinishSpan netcoreapp3.1 651ns 0.308ns 1.15ns 0.00737 0 0 536 B
#4686 StartFinishSpan net472 635ns 0.186ns 0.694ns 0.0853 0 0 538 B
#4686 StartFinishScope net6.0 545ns 0.174ns 0.676ns 0.00929 0 0 656 B
#4686 StartFinishScope netcoreapp3.1 832ns 0.294ns 1.1ns 0.00873 0 0 656 B
#4686 StartFinishScope net472 736ns 1.15ns 4.45ns 0.0979 0 0 618 B
Benchmarks.Trace.TraceAnnotationsBenchmark - Faster :tada: Same allocations :heavy_check_mark:

Faster :tada: in #4686

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 1.119 645.17 576.78

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 645ns 0.176ns 0.681ns 0.00896 0 0 656 B
master RunOnMethodBegin netcoreapp3.1 823ns 0.284ns 1.06ns 0.00861 0 0 656 B
master RunOnMethodBegin net472 999ns 0.224ns 0.837ns 0.0981 0 0 618 B
#4686 RunOnMethodBegin net6.0 577ns 0.143ns 0.555ns 0.00919 0 0 656 B
#4686 RunOnMethodBegin netcoreapp3.1 767ns 0.437ns 1.51ns 0.00892 0 0 656 B
#4686 RunOnMethodBegin net472 938ns 0.239ns 0.895ns 0.0981 0 0 618 B

andrewlock avatar Oct 03 '23 23:10 andrewlock

We used an Internal suffix for everything else 😬 I fear the inconsistency may cause @lucaspimentel to lose consciousness...

Any chance we can switch InternalInstance to InstanceInternal instead? Or should we change all our other cases? Or do we not care? 😅

Huh, I was modelling this change after our Tracer.InternalActiveScope naming, hence Tracer.InternalInstance. I suppose we're now a little inconsistent across the Datadog.Trace codebase but at least the Tracer fields will be consistent, so I'm okay as-is 😅

zacharycmontoya avatar Oct 04 '23 20:10 zacharycmontoya

This is wayyy out of date now and superseded by the work from @andrewlock to make implement v3 custom instrumentation via automatic instrumentation

zacharycmontoya avatar May 09 '24 23:05 zacharycmontoya