Skip to content

Conversation

bouwkast
Copy link
Collaborator

@bouwkast bouwkast commented Oct 9, 2025

PR by Bits to fix issue 1c4eaaa2-3c88-11f0-9cbd-da7ad0900002.

You can ask for changes by mentioning @DataDog in a comment.

Feedback (especially what can be better) welcome in #code-gen-feedback!


Summary of changes

  • In ConfigureIntegration.ConfigureSettingsWithManualOverrides, detect when the current TracerManager is locked (ILockedTracer) and skip calling Tracer.Configure, logging an informational message instead.
  • Add Datadog.Trace.Logging dependency and a logger to ConfigureIntegration.
  • Add unit test ConfigureIntegrationTests to verify no exception is thrown and the locked manager is not replaced.

Reason for change

Manual instrumentation attempted to replace the global tracer while a locked TracerManager was active (e.g., in CI Test Optimization). This triggered an InvalidOperationException from CreateInitializedTracer ("The current tracer instance cannot be replaced"), which bubbled through the CallTarget integration. Skipping configuration when the tracer is locked prevents this failure.

Implementation details

  • Early-return in ConfigureSettingsWithManualOverrides if TracerManager.Instance is ILockedTracer.
  • Log an informational message indicating that manual configuration was skipped due to a locked tracer.
  • Preserve existing behavior (including telemetry metric recording) when the tracer is not locked.

Test coverage

  • New test ConfigureSettingsWithManualOverrides_DoesNotThrow_WhenTracerIsLocked:
    • Replaces the global manager with a LockedTracerManager implementing ILockedTracer.
    • Calls ConfigureSettingsWithManualOverrides and asserts no exception and that the manager remains locked.
    • Uses TracerInstanceTestCollection and TracerRestorer to isolate global tracer state.

Other details

  • No change to configuration behavior when the tracer is not locked.
  • Minimal surface area change; only manual instrumentation path is affected.
  • Log message: "Skipping Tracer.Configure from manual instrumentation because the current tracer instance is locked and cannot be replaced."

<!-- Fixes #{issue} -->

`<!-- ⚠️ Note:

Where possible, please obtain 2 approvals prior to merging. Unless CODEOWNERS specifies otherwise, for external teams it is typically best to have one review from a team member, and one review from apm-dotnet. Trivial changes do not require 2 reviews.

MergeQueue is NOT enabled in this repository. If you have write access to the repo, the PR has 1-2 approvals (see above), and all of the required checks have passed, you can use the Squash and Merge button to merge the PR. If you don't have write access, or you need help, reach out in the #apm-dotnet channel in Slack.
-->`

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Oct 9, 2025

Bits AI Dev Agent Status: ✅ Done [Fix CI Errors]

Status History (1 entries)
2025-10-09 18:11:22 UTC ❌ Failed to process PR comment

You can ask for changes by mentioning @DataDog in a comment.

Comment on lines 10 to 16
using Datadog.Trace.Logging;
using Datadog.Trace.Configuration;
using Datadog.Trace.Configuration.ConfigurationSources;
using Datadog.Trace.Configuration.ConfigurationSources.Telemetry;
using Datadog.Trace.Configuration.Telemetry;
using Datadog.Trace.Telemetry;
using Datadog.Trace.Telemetry.Metrics;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@DataDog

Suggested change
using Datadog.Trace.Configuration;
using Datadog.Trace.Configuration.ConfigurationSources;
using Datadog.Trace.Configuration.ConfigurationSources.Telemetry;
using Datadog.Trace.Configuration.Telemetry;
using Datadog.Trace.Logging;
using Datadog.Trace.Telemetry;
using Datadog.Trace.Telemetry.Metrics;

Choose a reason for hiding this comment

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

Something went wrong! If you want me to try again, please let me know.

Comment on lines 6 to 13
using System.Collections.Generic;
using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Tracer;
using Datadog.Trace.Logging.TracerFlare;
using Datadog.Trace.RemoteConfigurationManagement;
using Datadog.Trace.TestHelpers;
using FluentAssertions;
using Moq;
using Xunit;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@DataDog

Suggested change
using System.Collections.Generic;
using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Tracer;
using Datadog.Trace.Logging.TracerFlare;
using Datadog.Trace.RemoteConfigurationManagement;
using Datadog.Trace.TestHelpers;
using FluentAssertions;
using Moq;
using Xunit;
using System.Collections.Generic;
using Datadog.Trace.Agent;
using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Tracer;
using Datadog.Trace.Configuration;
using Datadog.Trace.Logging.TracerFlare;
using Datadog.Trace.RemoteConfigurationManagement;
using Datadog.Trace.TestHelpers;
using FluentAssertions;
using Moq;
using Xunit;

Choose a reason for hiding this comment

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

Something went wrong! If you want me to try again, please let me know.

Copy link

Something went wrong! If you want me to try again, please let me know.

@bouwkast
Copy link
Collaborator Author

bouwkast commented Oct 9, 2025

Unsure what is better TBH, swallowing the exception and doing nothing or throwing the exception 🤔

@dd-trace-dotnet-ci-bot
Copy link

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.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7637) - mean (72ms)  : 71, 73
     .   : milestone, 72,
    master - mean (72ms)  : 71, 73
     .   : milestone, 72,

    section Baseline
    This PR (7637) - mean (68ms)  : 66, 70
     .   : milestone, 68,
    master - mean (68ms)  : 66, 70
     .   : milestone, 68,

    section CallTarget+Inlining+NGEN
    This PR (7637) - mean (1,048ms)  : 997, 1099
     .   : milestone, 1048,
    master - mean (1,053ms)  : 987, 1119
     .   : milestone, 1053,

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

    section Baseline
    This PR (7637) - mean (106ms)  : 104, 108
     .   : milestone, 106,
    master - mean (106ms)  : 103, 108
     .   : milestone, 106,

    section CallTarget+Inlining+NGEN
    This PR (7637) - mean (743ms)  : 719, 766
     .   : milestone, 743,
    master - mean (747ms)  : 717, 777
     .   : milestone, 747,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7637) - mean (101ms)  : 99, 102
     .   : milestone, 101,
    master - mean (101ms)  : 99, 102
     .   : milestone, 101,

    section Baseline
    This PR (7637) - mean (99ms)  : 97, 102
     .   : milestone, 99,
    master - mean (100ms)  : 98, 102
     .   : milestone, 100,

    section CallTarget+Inlining+NGEN
    This PR (7637) - mean (799ms)  : 703, 895
     .   : milestone, 799,
    master - mean (772ms)  : 722, 822
     .   : milestone, 772,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7637) - mean (102ms)  : crit, 70, 134
     .   : crit, milestone, 102,
    master - mean (93ms)  : 92, 94
     .   : milestone, 93,

    section Baseline
    This PR (7637) - mean (127ms)  : 122, 131
     .   : milestone, 127,
    master - mean (92ms)  : 90, 95
     .   : milestone, 92,

    section CallTarget+Inlining+NGEN
    This PR (7637) - mean (668ms)  : 644, 692
     .   : milestone, 668,
    master - mean (664ms)  : 651, 677
     .   : milestone, 664,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7637) - mean (204ms)  : 200, 207
     .   : milestone, 204,
    master - mean (204ms)  : 199, 209
     .   : milestone, 204,

    section Baseline
    This PR (7637) - mean (200ms)  : 196, 204
     .   : milestone, 200,
    master - mean (200ms)  : 195, 205
     .   : milestone, 200,

    section CallTarget+Inlining+NGEN
    This PR (7637) - mean (1,194ms)  : 1136, 1252
     .   : milestone, 1194,
    master - mean (1,200ms)  : 1129, 1271
     .   : milestone, 1200,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7637) - mean (287ms)  : 282, 291
     .   : milestone, 287,
    master - mean (290ms)  : 283, 297
     .   : milestone, 290,

    section Baseline
    This PR (7637) - mean (287ms)  : 279, 295
     .   : milestone, 287,
    master - mean (291ms)  : 283, 299
     .   : milestone, 291,

    section CallTarget+Inlining+NGEN
    This PR (7637) - mean (956ms)  : 919, 993
     .   : milestone, 956,
    master - mean (976ms)  : 940, 1013
     .   : milestone, 976,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7637) - mean (290ms)  : 285, 295
     .   : milestone, 290,
    master - mean (297ms)  : 288, 306
     .   : milestone, 297,

    section Baseline
    This PR (7637) - mean (290ms)  : 285, 295
     .   : milestone, 290,
    master - mean (296ms)  : 287, 305
     .   : milestone, 296,

    section CallTarget+Inlining+NGEN
    This PR (7637) - mean (1,037ms)  : 931, 1144
     .   : milestone, 1037,
    master - mean (1,020ms)  : 981, 1059
     .   : milestone, 1020,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7637) - mean (286ms)  : 280, 293
     .   : milestone, 286,
    master - mean (279ms)  : 272, 286
     .   : milestone, 279,

    section Baseline
    This PR (7637) - mean (338ms)  : 329, 346
     .   : milestone, 338,
    master - mean (278ms)  : 273, 283
     .   : milestone, 278,

    section CallTarget+Inlining+NGEN
    This PR (7637) - mean (876ms)  : 847, 906
     .   : milestone, 876,
    master - mean (876ms)  : 850, 903
     .   : milestone, 876,

Loading

@pr-commenter
Copy link

pr-commenter bot commented Oct 9, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7637 compared to master:

  • 2 benchmarks are faster, with geometric mean 1.891
  • 1 benchmarks are slower, with geometric mean 1.120
  • 3 benchmarks have fewer allocations
  • 10 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 ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7637

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.07 KB 6.03 KB -37 B -0.61%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.4μs 57.6ns 350ns 0 0 0 5.52 KB
master StartStopWithChild netcoreapp3.1 13.7μs 70.4ns 352ns 0 0 0 5.71 KB
master StartStopWithChild net472 21.8μs 123ns 832ns 0.978 0.326 0.109 6.07 KB
#7637 StartStopWithChild net6.0 10.3μs 57.4ns 349ns 0 0 0 5.53 KB
#7637 StartStopWithChild netcoreapp3.1 13.3μs 69.1ns 324ns 0 0 0 5.71 KB
#7637 StartStopWithChild net472 22μs 112ns 535ns 0.992 0.441 0.11 6.03 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 929μs 87ns 301ns 0 0 0 2.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.03ms 212ns 821ns 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.18ms 26.4ns 91.4ns 0 0 0 3.31 KB
#7637 WriteAndFlushEnrichedTraces net6.0 930μs 74.4ns 268ns 0 0 0 2.71 KB
#7637 WriteAndFlushEnrichedTraces netcoreapp3.1 1.03ms 255ns 989ns 0 0 0 2.7 KB
#7637 WriteAndFlushEnrichedTraces net472 1.19ms 52.5ns 197ns 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 346μs 491ns 1.9μs 0 0 0 178.25 KB
master AllCycleSimpleBody netcoreapp3.1 522μs 1.99μs 7.7μs 0 0 0 184.01 KB
master AllCycleSimpleBody net472 457μs 95.2ns 369ns 31.2 0 0 203.96 KB
master AllCycleMoreComplexBody net6.0 351μs 1.7μs 6.79μs 0 0 0 181.77 KB
master AllCycleMoreComplexBody netcoreapp3.1 513μs 1.28μs 4.98μs 0 0 0 187.44 KB
master AllCycleMoreComplexBody net472 470μs 101ns 391ns 32.4 0 0 207.5 KB
master ObjectExtractorSimpleBody net6.0 317ns 1.84ns 14ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 405ns 2.19ns 11.8ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 297ns 0.0128ns 0.0461ns 0.0435 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.28μs 29.4ns 114ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.94μs 27.7ns 99.8ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.7μs 3.41ns 13.2ns 0.571 0 0 3.8 KB
#7637 AllCycleSimpleBody net6.0 341μs 1.74μs 8.18μs 0 0 0 178.25 KB
#7637 AllCycleSimpleBody netcoreapp3.1 518μs 2.03μs 8.86μs 0 0 0 184.01 KB
#7637 AllCycleSimpleBody net472 459μs 114ns 440ns 31.2 0 0 203.96 KB
#7637 AllCycleMoreComplexBody net6.0 354μs 236ns 851ns 0 0 0 181.77 KB
#7637 AllCycleMoreComplexBody netcoreapp3.1 526μs 1.83μs 7.08μs 0 0 0 187.44 KB
#7637 AllCycleMoreComplexBody net472 469μs 106ns 411ns 32.4 0 0 207.5 KB
#7637 ObjectExtractorSimpleBody net6.0 324ns 0.193ns 0.747ns 0 0 0 280 B
#7637 ObjectExtractorSimpleBody netcoreapp3.1 403ns 2.1ns 10.5ns 0 0 0 272 B
#7637 ObjectExtractorSimpleBody net472 303ns 0.024ns 0.0896ns 0.044 0 0 281 B
#7637 ObjectExtractorMoreComplexBody net6.0 6.2μs 34.1ns 193ns 0 0 0 3.78 KB
#7637 ObjectExtractorMoreComplexBody netcoreapp3.1 7.65μs 36.5ns 141ns 0 0 0 3.69 KB
#7637 ObjectExtractorMoreComplexBody net472 6.68μs 7.51ns 29.1ns 0.597 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 78μs 33.5ns 130ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 97.6μs 110ns 425ns 0 0 0 32.4 KB
master EncodeArgs net472 112μs 17ns 65.7ns 5.03 0 0 32.51 KB
master EncodeLegacyArgs net6.0 146μs 17.8ns 66.6ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 200μs 157ns 586ns 0 0 0 2.14 KB
master EncodeLegacyArgs net472 262μs 48.9ns 189ns 0 0 0 2.16 KB
#7637 EncodeArgs net6.0 77.2μs 114ns 426ns 0 0 0 32.4 KB
#7637 EncodeArgs netcoreapp3.1 97.7μs 152ns 589ns 0 0 0 32.4 KB
#7637 EncodeArgs net472 109μs 19.9ns 77ns 4.9 0 0 32.51 KB
#7637 EncodeLegacyArgs net6.0 143μs 68.1ns 255ns 0 0 0 2.14 KB
#7637 EncodeLegacyArgs netcoreapp3.1 199μs 334ns 1.3μs 0 0 0 2.14 KB
#7637 EncodeLegacyArgs net472 261μs 19.1ns 73.9ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #7637

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 2.094 854,418.12 408,078.33
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑netcoreapp3.1 1.708 508,007.09 297,404.12

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 396μs 51.9ns 194ns 0 0 0 4.56 KB
master RunWafRealisticBenchmark netcoreapp3.1 809μs 10.1μs 101μs 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 429μs 41.9ns 162ns 0 0 0 4.66 KB
master RunWafRealisticBenchmarkWithAttack net6.0 287μs 41.7ns 161ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 511μs 1.63μs 5.64μs 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 312μs 37.5ns 145ns 0 0 0 2.29 KB
#7637 RunWafRealisticBenchmark net6.0 400μs 136ns 491ns 0 0 0 4.55 KB
#7637 RunWafRealisticBenchmark netcoreapp3.1 409μs 366ns 1.27μs 0 0 0 4.48 KB
#7637 RunWafRealisticBenchmark net472 429μs 45.3ns 169ns 0 0 0 4.66 KB
#7637 RunWafRealisticBenchmarkWithAttack net6.0 287μs 24.2ns 90.4ns 0 0 0 2.24 KB
#7637 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 298μs 354ns 1.23μs 0 0 0 2.22 KB
#7637 RunWafRealisticBenchmarkWithAttack net472 310μs 29.3ns 114ns 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.2μs 152ns 549ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 72.1μs 316ns 1.14μs 0 0 0 17.42 KB
master SendRequest net472 0.00132ns 0.000712ns 0.00276ns 0 0 0 0 b
#7637 SendRequest net6.0 60.9μs 68ns 254ns 0 0 0 14.52 KB
#7637 SendRequest netcoreapp3.1 71.2μs 88.3ns 318ns 0 0 0 17.42 KB
#7637 SendRequest net472 0.00113ns 0.00077ns 0.00288ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7637

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 47 B 47 B
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 4 B 7 B 3 B 75.00%
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 3 B 4 B 1 B 33.33%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.95ms 230ns 831ns 0 0 0 640.01 KB
master OriginalCharSlice netcoreapp3.1 2.14ms 3.68μs 14.3μs 0 0 0 640 KB
master OriginalCharSlice net472 2.62ms 454ns 1.7μs 100 0 0 641.95 KB
master OptimizedCharSlice net6.0 1.39ms 149ns 577ns 0 0 0 4 B
master OptimizedCharSlice netcoreapp3.1 1.68ms 353ns 1.37μs 0 0 0 1 B
master OptimizedCharSlice net472 2.07ms 293ns 1.13μs 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 795μs 38.8ns 150ns 0 0 0 3 B
master OptimizedCharSliceWithPool netcoreapp3.1 849μs 127ns 475ns 0 0 0 1 B
master OptimizedCharSliceWithPool net472 1.14ms 114ns 443ns 0 0 0 0 b
#7637 OriginalCharSlice net6.0 1.89ms 1.38μs 5.17μs 0 0 0 640.01 KB
#7637 OriginalCharSlice netcoreapp3.1 2.13ms 6.04μs 22.6μs 0 0 0 640 KB
#7637 OriginalCharSlice net472 2.74ms 2μs 7.73μs 100 0 0 641.95 KB
#7637 OptimizedCharSlice net6.0 1.39ms 180ns 697ns 0 0 0 7 B
#7637 OptimizedCharSlice netcoreapp3.1 1.78ms 168ns 652ns 0 0 0 1 B
#7637 OptimizedCharSlice net472 1.98ms 263ns 1.02μs 0 0 0 73 B
#7637 OptimizedCharSliceWithPool net6.0 799μs 70.8ns 274ns 0 0 0 4 B
#7637 OptimizedCharSliceWithPool netcoreapp3.1 814μs 65.3ns 253ns 0 0 0 1 B
#7637 OptimizedCharSliceWithPool net472 1.13ms 115ns 443ns 0 0 0 47 B
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7637

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 41.68 KB 42.67 KB 992 B 2.38%

Fewer allocations 🎉 in #7637

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 56.15 KB 55.66 KB -491 B -0.87%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 684μs 1.76μs 6.34μs 0 0 0 41.68 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 652μs 671ns 2.42μs 0 0 0 41.78 KB
master WriteAndFlushEnrichedTraces net472 861μs 4.02μs 16.1μs 8.33 0 0 56.15 KB
#7637 WriteAndFlushEnrichedTraces net6.0 613μs 1μs 3.61μs 0 0 0 42.67 KB
#7637 WriteAndFlushEnrichedTraces netcoreapp3.1 651μs 2.1μs 7.27μs 0 0 0 41.89 KB
#7637 WriteAndFlushEnrichedTraces net472 819μs 2.08μs 9.74μs 4.46 0 0 55.66 KB
Benchmarks.Trace.DbCommandBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #7637

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑netcoreapp3.1 1.120 2,556.38 2,863.44

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.89μs 9.81ns 44.9ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.55μs 7.5ns 29.1ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.75μs 6.26ns 24.2ns 0.15 0.0136 0 987 B
#7637 ExecuteNonQuery net6.0 1.91μs 8.96ns 35.8ns 0 0 0 1.02 KB
#7637 ExecuteNonQuery netcoreapp3.1 2.86μs 9.33ns 36.2ns 0 0 0 1.02 KB
#7637 ExecuteNonQuery net472 2.75μs 5.06ns 19.6ns 0.151 0.0275 0.0137 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.77μs 4.75ns 18.4ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.36μs 4.73ns 17ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.5μs 1.18ns 4.56ns 0.157 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.81μs 8.53ns 33ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.49μs 1.89ns 6.55ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.86μs 7.14ns 27.7ns 0.174 0 0 1.1 KB
#7637 CallElasticsearch net6.0 1.75μs 3.46ns 13.4ns 0 0 0 1.03 KB
#7637 CallElasticsearch netcoreapp3.1 2.32μs 5.74ns 22.2ns 0 0 0 1.03 KB
#7637 CallElasticsearch net472 3.51μs 2.82ns 10.9ns 0.159 0 0 1.04 KB
#7637 CallElasticsearchAsync net6.0 1.91μs 6.73ns 26.1ns 0 0 0 1.01 KB
#7637 CallElasticsearchAsync netcoreapp3.1 2.39μs 12.3ns 57.8ns 0 0 0 1.08 KB
#7637 CallElasticsearchAsync net472 3.82μs 1.73ns 6.47ns 0.171 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.89μs 7.22ns 28ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.41μs 10.1ns 39.1ns 0 0 0 952 B
master ExecuteAsync net472 2.52μs 1.73ns 6.49ns 0.138 0 0 915 B
#7637 ExecuteAsync net6.0 1.85μs 9.1ns 38.6ns 0 0 0 952 B
#7637 ExecuteAsync netcoreapp3.1 2.24μs 4.55ns 16.4ns 0 0 0 952 B
#7637 ExecuteAsync net472 2.52μs 5.29ns 20.5ns 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 7μs 24ns 93ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.39μs 21.6ns 77.7ns 0 0 0 2.9 KB
master SendAsync net472 12.2μs 10.5ns 39.1ns 0.486 0 0 3.18 KB
#7637 SendAsync net6.0 7μs 6.01ns 22.5ns 0 0 0 2.36 KB
#7637 SendAsync netcoreapp3.1 8.36μs 24.6ns 95.4ns 0 0 0 2.9 KB
#7637 SendAsync net472 12μs 7.21ns 27ns 0.482 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7637

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 57.34 KB 65.54 KB 8.19 KB 14.29%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 249.34 KB 273.77 KB 24.43 KB 9.80%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 286.72 KB 294.91 KB 8.19 KB 2.86%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 258.38 KB 262.01 KB 3.62 KB 1.40%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 43.44 KB 43.71 KB 272 B 0.63%

Fewer allocations 🎉 in #7637

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 43.6 KB 43.23 KB -368 B -0.84%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 42.3μs 188ns 1.06μs 0 0 0 43.44 KB
master StringConcatBenchmark netcoreapp3.1 50.2μs 274ns 2.27μs 0 0 0 43.6 KB
master StringConcatBenchmark net472 56.3μs 157ns 588ns 0 0 0 57.34 KB
master StringConcatAspectBenchmark net6.0 464μs 1.26μs 5.03μs 0 0 0 258.38 KB
master StringConcatAspectBenchmark netcoreapp3.1 522μs 1.98μs 7.43μs 0 0 0 249.34 KB
master StringConcatAspectBenchmark net472 404μs 2.1μs 10.7μs 0 0 0 286.72 KB
#7637 StringConcatBenchmark net6.0 44.5μs 264ns 2.45μs 0 0 0 43.71 KB
#7637 StringConcatBenchmark netcoreapp3.1 50.5μs 296ns 2.44μs 0 0 0 43.23 KB
#7637 StringConcatBenchmark net472 56.4μs 283ns 1.2μs 0 0 0 65.54 KB
#7637 StringConcatAspectBenchmark net6.0 477μs 1.91μs 6.9μs 0 0 0 262.01 KB
#7637 StringConcatAspectBenchmark netcoreapp3.1 532μs 2.34μs 8.12μs 0 0 0 273.77 KB
#7637 StringConcatAspectBenchmark net472 400μs 1.85μs 7.4μs 0 0 0 294.91 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.53μs 12.3ns 49ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.54μs 18.3ns 77.6ns 0 0 0 1.7 KB
master EnrichedLog net472 3.73μs 2.84ns 11ns 0.244 0 0 1.64 KB
#7637 EnrichedLog net6.0 2.44μs 13.8ns 94.8ns 0 0 0 1.7 KB
#7637 EnrichedLog netcoreapp3.1 3.53μs 17.8ns 79.7ns 0 0 0 1.7 KB
#7637 EnrichedLog net472 3.75μs 4.69ns 18.2ns 0.244 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 122μs 112ns 403ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 131μs 635ns 3.42μs 0 0 0 4.31 KB
master EnrichedLog net472 167μs 212ns 763ns 0 0 0 4.52 KB
#7637 EnrichedLog net6.0 122μs 104ns 387ns 0 0 0 4.31 KB
#7637 EnrichedLog netcoreapp3.1 128μs 337ns 1.21μs 0 0 0 4.31 KB
#7637 EnrichedLog net472 166μs 157ns 606ns 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 4.84μs 20.4ns 79.1ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.84μs 17ns 65.8ns 0 0 0 2.26 KB
master EnrichedLog net472 7.2μs 4.35ns 16.9ns 0.323 0 0 2.08 KB
#7637 EnrichedLog net6.0 4.86μs 22.4ns 83.7ns 0 0 0 2.26 KB
#7637 EnrichedLog netcoreapp3.1 6.74μs 16.3ns 63.2ns 0 0 0 2.26 KB
#7637 EnrichedLog net472 7.38μs 5.62ns 21.8ns 0.294 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μs 0.487ns 1.82ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.58μs 13.2ns 60.4ns 0 0 0 1.2 KB
master SendReceive net472 2.98μs 2.69ns 10ns 0.18 0 0 1.2 KB
#7637 SendReceive net6.0 2.01μs 10.6ns 52.2ns 0 0 0 1.2 KB
#7637 SendReceive netcoreapp3.1 2.74μs 7.15ns 26.7ns 0 0 0 1.2 KB
#7637 SendReceive net472 3.07μs 4.25ns 16.5ns 0.183 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.15μs 17.3ns 67ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.35μs 8.74ns 31.5ns 0 0 0 1.63 KB
master EnrichedLog net472 6.45μs 7.6ns 29.4ns 0.291 0 0 2.03 KB
#7637 EnrichedLog net6.0 4.22μs 16ns 61.8ns 0 0 0 1.58 KB
#7637 EnrichedLog netcoreapp3.1 5.39μs 5.6ns 21ns 0 0 0 1.63 KB
#7637 EnrichedLog net472 6.38μs 2.35ns 8.47ns 0.32 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 740ns 3.29ns 12.7ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 941ns 4.44ns 17.8ns 0 0 0 576 B
master StartFinishSpan net472 923ns 2.87ns 11.1ns 0.0913 0 0 578 B
master StartFinishScope net6.0 902ns 4.51ns 19.7ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.15μs 6.07ns 29.1ns 0 0 0 696 B
master StartFinishScope net472 1.09μs 0.455ns 1.7ns 0.104 0 0 658 B
#7637 StartFinishSpan net6.0 744ns 0.548ns 2.12ns 0 0 0 576 B
#7637 StartFinishSpan netcoreapp3.1 906ns 4.86ns 25.3ns 0 0 0 576 B
#7637 StartFinishSpan net472 876ns 0.258ns 0.966ns 0.0876 0 0 578 B
#7637 StartFinishScope net6.0 871ns 4.61ns 23.5ns 0 0 0 696 B
#7637 StartFinishScope netcoreapp3.1 1.17μs 6.17ns 32.7ns 0 0 0 696 B
#7637 StartFinishScope net472 1.1μs 4.42ns 17.1ns 0.101 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.01μs 5.01ns 21.8ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.4μs 6.57ns 25.4ns 0 0 0 696 B
master RunOnMethodBegin net472 1.44μs 1.77ns 6.85ns 0.1 0 0 658 B
#7637 RunOnMethodBegin net6.0 1.03μs 5.69ns 36ns 0 0 0 696 B
#7637 RunOnMethodBegin netcoreapp3.1 1.46μs 3.28ns 12.7ns 0 0 0 696 B
#7637 RunOnMethodBegin net472 1.44μs 1.66ns 6.43ns 0.101 0 0 658 B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant