Skip to content

Conversation

GreenMatan
Copy link
Contributor

@GreenMatan GreenMatan commented Aug 27, 2025

Summary of changes

Most of the work for DI&ER to support Stable Config is already done in #7304.
This PR completes the effort by decoupling DI/ER env vars from the native side of the tracer.

For DI/ER products to function correctly, the native side, among other things, need to inject a new field into each and every StateMachine type that is generated for async methods. Our injected field is used during the execution of DI/ER instrumentation to capture continuation of async flows.
The only point in time where it's possible to change type's layout is in ModuleLoadFinished event, and this event is fired only once per module.
Until Stable Configuration we only injected that field when DI/ER env vars were enable, but now we can not rely on these env var anymore as they're no longer the source of truth. With Stable Config we can not know if DI/ER will be enabled or not at startup. To accommodate that, the native side now acts as if DI/ER is enabled, just in case it will.
This is true not only for Stable Config, but also for Remote Enablement.

There are two new env vars:

  1. DD_DYNAMIC_INSTRUMENTATION_MANAGED_ACTIVATION_ENABLED
  2. DD_EXCEPTION_REPLAY_MANAGED_ACTIVATION_ENABLED

These env vars, as described in Stable Config Standby mode doc, are used to deactivate hot standby for ER/DI in case it'll be needed in the future, as a kill switch.

Reason for change

Fully support Stable Config.

Resolves DEBUG-4421

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

dd-trace-dotnet-ci-bot bot commented Aug 27, 2025

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 (7441) - mean (73ms)  : 72, 75
     .   : milestone, 73,
    master - mean (73ms)  : 72, 75
     .   : milestone, 73,

    section Baseline
    This PR (7441) - mean (70ms)  : 65, 74
     .   : milestone, 70,
    master - mean (70ms)  : 65, 75
     .   : milestone, 70,

    section CallTarget+Inlining+NGEN
    This PR (7441) - mean (1,002ms)  : 976, 1028
     .   : milestone, 1002,
    master - mean (1,000ms)  : 966, 1034
     .   : milestone, 1000,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7441) - mean (109ms)  : 107, 111
     .   : milestone, 109,
    master - mean (109ms)  : 107, 111
     .   : milestone, 109,

    section Baseline
    This PR (7441) - mean (109ms)  : 106, 111
     .   : milestone, 109,
    master - mean (108ms)  : 106, 110
     .   : milestone, 108,

    section CallTarget+Inlining+NGEN
    This PR (7441) - mean (710ms)  : 689, 731
     .   : milestone, 710,
    master - mean (707ms)  : 688, 726
     .   : milestone, 707,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7441) - mean (96ms)  : 95, 98
     .   : milestone, 96,
    master - mean (96ms)  : 94, 97
     .   : milestone, 96,

    section Baseline
    This PR (7441) - mean (96ms)  : 93, 99
     .   : milestone, 96,
    master - mean (95ms)  : 93, 98
     .   : milestone, 95,

    section CallTarget+Inlining+NGEN
    This PR (7441) - mean (665ms)  : 644, 686
     .   : milestone, 665,
    master - mean (661ms)  : 639, 683
     .   : milestone, 661,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7441) - mean (95ms)  : 94, 97
     .   : milestone, 95,
    master - mean (95ms)  : 93, 97
     .   : milestone, 95,

    section Baseline
    This PR (7441) - mean (94ms)  : 92, 97
     .   : milestone, 94,
    master - mean (94ms)  : 92, 96
     .   : milestone, 94,

    section CallTarget+Inlining+NGEN
    This PR (7441) - mean (598ms)  : 589, 608
     .   : milestone, 598,
    master - mean (601ms)  : 585, 617
     .   : milestone, 601,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7441) - mean (197ms)  : 193, 202
     .   : milestone, 197,
    master - mean (192ms)  : 191, 194
     .   : milestone, 192,

    section Baseline
    This PR (7441) - mean (197ms)  : 186, 208
     .   : milestone, 197,
    master - mean (189ms)  : 185, 194
     .   : milestone, 189,

    section CallTarget+Inlining+NGEN
    This PR (7441) - mean (1,142ms)  : 1100, 1185
     .   : milestone, 1142,
    master - mean (1,095ms)  : 1068, 1122
     .   : milestone, 1095,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7441) - mean (284ms)  : 274, 294
     .   : milestone, 284,
    master - mean (273ms)  : 270, 276
     .   : milestone, 273,

    section Baseline
    This PR (7441) - mean (284ms)  : 272, 296
     .   : milestone, 284,
    master - mean (273ms)  : 268, 279
     .   : milestone, 273,

    section CallTarget+Inlining+NGEN
    This PR (7441) - mean (917ms)  : 871, 963
     .   : milestone, 917,
    master - mean (892ms)  : 857, 926
     .   : milestone, 892,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7441) - mean (271ms)  : 264, 278
     .   : milestone, 271,
    master - mean (265ms)  : 262, 268
     .   : milestone, 265,

    section Baseline
    This PR (7441) - mean (278ms)  : 269, 286
     .   : milestone, 278,
    master - mean (266ms)  : 262, 270
     .   : milestone, 266,

    section CallTarget+Inlining+NGEN
    This PR (7441) - mean (910ms)  : 865, 955
     .   : milestone, 910,
    master - mean (869ms)  : 837, 901
     .   : milestone, 869,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Bailout
    This PR (7441) - mean (274ms)  : 266, 282
     .   : milestone, 274,
    master - mean (265ms)  : 262, 268
     .   : milestone, 265,

    section Baseline
    This PR (7441) - mean (276ms)  : 259, 293
     .   : milestone, 276,
    master - mean (265ms)  : 261, 270
     .   : milestone, 265,

    section CallTarget+Inlining+NGEN
    This PR (7441) - mean (812ms)  : 776, 847
     .   : milestone, 812,
    master - mean (786ms)  : 760, 811
     .   : milestone, 786,

Loading

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Aug 27, 2025

⚠️ Tests

⚠️ Warnings

🧪 5 Tests failed

WhenDynamicCodeIsDisabled_DoesNotInstrument from Datadog.Trace.ClrProfiler.IntegrationTests.InstrumentationTests (Datadog)
Expected exit code: 0, actual exit code: 134.
WhenDynamicCodeIsDisabled_DoesNotInstrument from Datadog.Trace.ClrProfiler.IntegrationTests.InstrumentationTests (Datadog)
Expected exit code: 0, actual exit code: 134.
WhenDynamicCodeIsDisabled_DoesNotInstrument from Datadog.Trace.ClrProfiler.IntegrationTests.InstrumentationTests (Datadog)
Expected exit code: 0, actual exit code: 134.
View all

ℹ️ Info

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d353039 | Docs | Was this helpful? Give us feedback!

@pr-commenter
Copy link

pr-commenter bot commented Aug 27, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7441 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.115
  • 1 benchmarks are slower, with geometric mean 2.068
  • 5 benchmarks have fewer allocations
  • 8 benchmarks have more allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7441

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑netcoreapp3.1 5.61 KB 5.71 KB 97 B 1.73%
Benchmarks.Trace.ActivityBenchmark.StartStopWithChild‑net472 6.03 KB 6.08 KB 46 B 0.76%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.6μs 52.1ns 227ns 0 0 0 5.51 KB
master StartStopWithChild netcoreapp3.1 13.8μs 61.1ns 237ns 0 0 0 5.61 KB
master StartStopWithChild net472 21.8μs 120ns 690ns 0.987 0.329 0.11 6.03 KB
#7441 StartStopWithChild net6.0 10.7μs 55.1ns 247ns 0 0 0 5.49 KB
#7441 StartStopWithChild netcoreapp3.1 13.3μs 44.4ns 166ns 0 0 0 5.71 KB
#7441 StartStopWithChild net472 21.8μs 105ns 405ns 0.867 0.217 0 6.08 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 914μs 73.7ns 285ns 0 0 0 2.71 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 1.04ms 690ns 2.67μs 0 0 0 2.7 KB
master WriteAndFlushEnrichedTraces net472 1.18ms 52.9ns 198ns 0 0 0 3.31 KB
#7441 WriteAndFlushEnrichedTraces net6.0 938μs 273ns 1.02μs 0 0 0 2.71 KB
#7441 WriteAndFlushEnrichedTraces netcoreapp3.1 1.03ms 516ns 2μs 0 0 0 2.7 KB
#7441 WriteAndFlushEnrichedTraces net472 1.19ms 48.1ns 186ns 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 326μs 649ns 2.51μs 0 0 0 172.08 KB
master AllCycleSimpleBody netcoreapp3.1 496μs 467ns 1.81μs 0 0 0 174.18 KB
master AllCycleSimpleBody net472 424μs 176ns 683ns 29.2 0 0 194.24 KB
master AllCycleMoreComplexBody net6.0 336μs 693ns 2.68μs 0 0 0 175.58 KB
master AllCycleMoreComplexBody netcoreapp3.1 498μs 748ns 2.8μs 0 0 0 177.6 KB
master AllCycleMoreComplexBody net472 433μs 85.3ns 308ns 30.2 0 0 197.76 KB
master ObjectExtractorSimpleBody net6.0 324ns 0.527ns 2.04ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 402ns 0.613ns 2.37ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 299ns 0.0355ns 0.133ns 0.0436 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.22μs 27.4ns 106ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.85μs 23.7ns 92ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.69μs 1.11ns 4.3ns 0.602 0 0 3.8 KB
#7441 AllCycleSimpleBody net6.0 317μs 958ns 3.71μs 0 0 0 172.07 KB
#7441 AllCycleSimpleBody netcoreapp3.1 454μs 204ns 789ns 0 0 0 174.18 KB
#7441 AllCycleSimpleBody net472 424μs 112ns 432ns 29.2 0 0 194.24 KB
#7441 AllCycleMoreComplexBody net6.0 327μs 116ns 448ns 0 0 0 175.58 KB
#7441 AllCycleMoreComplexBody netcoreapp3.1 466μs 97.9ns 353ns 0 0 0 177.6 KB
#7441 AllCycleMoreComplexBody net472 434μs 109ns 395ns 30.2 0 0 197.76 KB
#7441 ObjectExtractorSimpleBody net6.0 336ns 0.551ns 2.13ns 0 0 0 280 B
#7441 ObjectExtractorSimpleBody netcoreapp3.1 397ns 2.19ns 12.4ns 0 0 0 272 B
#7441 ObjectExtractorSimpleBody net472 299ns 0.0227ns 0.0877ns 0.0437 0 0 281 B
#7441 ObjectExtractorMoreComplexBody net6.0 6.2μs 31.6ns 167ns 0 0 0 3.78 KB
#7441 ObjectExtractorMoreComplexBody netcoreapp3.1 7.79μs 32.1ns 124ns 0 0 0 3.69 KB
#7441 ObjectExtractorMoreComplexBody net472 6.66μs 3.53ns 13.7ns 0.601 0 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EncodeArgs net6.0 75.6μs 344ns 1.33μs 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 97.5μs 178ns 689ns 0 0 0 32.4 KB
master EncodeArgs net472 109μs 9.8ns 36.7ns 4.92 0 0 32.5 KB
master EncodeLegacyArgs net6.0 149μs 33ns 123ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 198μs 279ns 1.08μs 0 0 0 2.14 KB
master EncodeLegacyArgs net472 264μs 48.1ns 186ns 0 0 0 2.17 KB
#7441 EncodeArgs net6.0 77μs 193ns 748ns 0 0 0 32.4 KB
#7441 EncodeArgs netcoreapp3.1 96.7μs 260ns 1.01μs 0 0 0 32.4 KB
#7441 EncodeArgs net472 109μs 39ns 151ns 4.9 0 0 32.51 KB
#7441 EncodeLegacyArgs net6.0 145μs 26.7ns 96.2ns 0 0 0 2.15 KB
#7441 EncodeLegacyArgs netcoreapp3.1 197μs 103ns 371ns 0 0 0 2.14 KB
#7441 EncodeLegacyArgs net472 264μs 24.3ns 84ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #7441

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑netcoreapp3.1 2.068 415,088.75 858,510.56

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 392μs 155ns 579ns 0 0 0 4.55 KB
master RunWafRealisticBenchmark netcoreapp3.1 415μs 257ns 994ns 0 0 0 4.48 KB
master RunWafRealisticBenchmark net472 438μs 52.7ns 197ns 0 0 0 4.66 KB
master RunWafRealisticBenchmarkWithAttack net6.0 289μs 137ns 531ns 0 0 0 2.24 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 300μs 215ns 832ns 0 0 0 2.22 KB
master RunWafRealisticBenchmarkWithAttack net472 318μs 38.4ns 144ns 0 0 0 2.29 KB
#7441 RunWafRealisticBenchmark net6.0 394μs 42.5ns 159ns 0 0 0 4.56 KB
#7441 RunWafRealisticBenchmark netcoreapp3.1 826μs 11.5μs 114μs 0 0 0 4.48 KB
#7441 RunWafRealisticBenchmark net472 434μs 56.6ns 219ns 0 0 0 4.66 KB
#7441 RunWafRealisticBenchmarkWithAttack net6.0 290μs 131ns 507ns 0 0 0 2.24 KB
#7441 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 303μs 126ns 470ns 0 0 0 2.22 KB
#7441 RunWafRealisticBenchmarkWithAttack net472 317μs 65.5ns 254ns 0 0 0 2.29 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7441

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.AspNetCoreBenchmark.SendRequest‑netcoreapp3.1 17.65 KB 17.42 KB -229 B -1.30%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 60.7μs 291ns 1.27μs 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 71.6μs 348ns 1.48μs 0 0 0 17.65 KB
master SendRequest net472 0.00405ns 0.00184ns 0.00712ns 0 0 0 0 b
#7441 SendRequest net6.0 60.5μs 75.4ns 272ns 0 0 0 14.52 KB
#7441 SendRequest netcoreapp3.1 70.4μs 171ns 615ns 0 0 0 17.42 KB
#7441 SendRequest net472 0.0216ns 0.000891ns 0.00345ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Faster 🎉 More allocations ⚠️

Faster 🎉 in #7441

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑netcoreapp3.1 1.115 1,874,160.00 1,680,435.00

More allocations ⚠️ in #7441

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 2 B 4 B 2 B 100.00%

Fewer allocations 🎉 in #7441

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

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.92ms 831ns 3.22μs 0 0 0 640.01 KB
master OriginalCharSlice netcoreapp3.1 2.16ms 8.41μs 32.6μs 0 0 0 640 KB
master OriginalCharSlice net472 2.59ms 335ns 1.3μs 100 0 0 641.95 KB
master OptimizedCharSlice net6.0 1.38ms 386ns 1.44μs 0 0 0 2 B
master OptimizedCharSlice netcoreapp3.1 1.87ms 494ns 1.91μs 0 0 0 1 B
master OptimizedCharSlice net472 2ms 264ns 1.02μs 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 800μs 56.9ns 220ns 0 0 0 3 B
master OptimizedCharSliceWithPool netcoreapp3.1 849μs 79.8ns 309ns 0 0 0 1 B
master OptimizedCharSliceWithPool net472 1.13ms 69.6ns 261ns 0 0 0 0 b
#7441 OriginalCharSlice net6.0 2.01ms 864ns 3.35μs 0 0 0 640.01 KB
#7441 OriginalCharSlice netcoreapp3.1 2.13ms 6.55μs 24.5μs 0 0 0 640 KB
#7441 OriginalCharSlice net472 2.63ms 516ns 1.86μs 100 0 0 641.95 KB
#7441 OptimizedCharSlice net6.0 1.42ms 395ns 1.53μs 0 0 0 4 B
#7441 OptimizedCharSlice netcoreapp3.1 1.68ms 249ns 965ns 0 0 0 1 B
#7441 OptimizedCharSlice net472 1.98ms 486ns 1.88μs 0 0 0 73 B
#7441 OptimizedCharSliceWithPool net6.0 813μs 26.7ns 103ns 0 0 0 3 B
#7441 OptimizedCharSliceWithPool netcoreapp3.1 828μs 36.3ns 131ns 0 0 0 0 b
#7441 OptimizedCharSliceWithPool net472 1.15ms 36.3ns 131ns 0 0 0 47 B
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Fewer allocations 🎉

Fewer allocations 🎉 in #7441

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net472 56.17 KB 55.74 KB -434 B -0.77%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 722μs 1.32μs 5.1μs 0 0 0 41.7 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 689μs 3.22μs 12.9μs 0 0 0 41.9 KB
master WriteAndFlushEnrichedTraces net472 929μs 4.47μs 19.5μs 4.46 0 0 56.17 KB
#7441 WriteAndFlushEnrichedTraces net6.0 722μs 4.07μs 29.1μs 0 0 0 41.75 KB
#7441 WriteAndFlushEnrichedTraces netcoreapp3.1 671μs 3.55μs 19.1μs 0 0 0 41.85 KB
#7441 WriteAndFlushEnrichedTraces net472 967μs 4.57μs 19.4μs 4.81 0 0 55.74 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.82μs 9.65ns 47.3ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.52μs 3.47ns 13ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.75μs 7.42ns 28.7ns 0.151 0.0138 0 987 B
#7441 ExecuteNonQuery net6.0 1.81μs 5.21ns 20.2ns 0 0 0 1.02 KB
#7441 ExecuteNonQuery netcoreapp3.1 2.62μs 1.15ns 4.46ns 0 0 0 1.02 KB
#7441 ExecuteNonQuery net472 2.91μs 15ns 75ns 0.144 0.0144 0 989 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.7μs 4.37ns 15.1ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.26μs 10.8ns 41.7ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.57μs 2.03ns 7.85ns 0.161 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.87μs 5.74ns 22.2ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.35μs 9.59ns 37.2ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.81μs 2.46ns 9.22ns 0.171 0 0 1.1 KB
#7441 CallElasticsearch net6.0 1.69μs 9.14ns 46.6ns 0 0 0 1.03 KB
#7441 CallElasticsearch netcoreapp3.1 2.22μs 10.5ns 43.1ns 0 0 0 1.03 KB
#7441 CallElasticsearch net472 3.59μs 1.56ns 6.02ns 0.161 0 0 1.04 KB
#7441 CallElasticsearchAsync net6.0 1.79μs 9.03ns 41.4ns 0 0 0 1.01 KB
#7441 CallElasticsearchAsync netcoreapp3.1 2.45μs 8.17ns 30.6ns 0 0 0 1.08 KB
#7441 CallElasticsearchAsync net472 3.74μs 2.69ns 10.1ns 0.168 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.76μs 9.07ns 44.4ns 0 0 0 953 B
master ExecuteAsync netcoreapp3.1 2.46μs 2.37ns 9.17ns 0 0 0 952 B
master ExecuteAsync net472 2.58μs 2.07ns 8.01ns 0.141 0 0 915 B
#7441 ExecuteAsync net6.0 1.84μs 4.61ns 17.9ns 0 0 0 952 B
#7441 ExecuteAsync netcoreapp3.1 2.42μs 11.2ns 43.4ns 0 0 0 952 B
#7441 ExecuteAsync net472 2.58μs 1.82ns 7.05ns 0.142 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.01μs 14.8ns 57.2ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.56μs 16.5ns 63.9ns 0 0 0 2.9 KB
master SendAsync net472 12.3μs 9.27ns 35.9ns 0.491 0 0 3.18 KB
#7441 SendAsync net6.0 7.03μs 6.91ns 25.8ns 0 0 0 2.36 KB
#7441 SendAsync netcoreapp3.1 8.34μs 24.5ns 95.1ns 0 0 0 2.9 KB
#7441 SendAsync net472 12.4μs 14ns 54.4ns 0.502 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7441

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 256.68 KB 274.37 KB 17.69 KB 6.89%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net472 278.61 KB 286.72 KB 8.11 KB 2.91%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net6.0 43.1 KB 44.11 KB 1.01 KB 2.34%

Fewer allocations 🎉 in #7441

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑netcoreapp3.1 43.18 KB 42.84 KB -336 B -0.78%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 276.95 KB 258.94 KB -18.01 KB -6.50%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 49.4μs 228ns 1.31μs 0 0 0 43.1 KB
master StringConcatBenchmark netcoreapp3.1 50.6μs 290ns 2.6μs 0 0 0 43.18 KB
master StringConcatBenchmark net472 56.8μs 160ns 619ns 0 0 0 65.54 KB
master StringConcatAspectBenchmark net6.0 487μs 2.12μs 9.48μs 0 0 0 276.95 KB
master StringConcatAspectBenchmark netcoreapp3.1 508μs 2.56μs 10.9μs 0 0 0 256.68 KB
master StringConcatAspectBenchmark net472 408μs 1.86μs 8.09μs 0 0 0 278.61 KB
#7441 StringConcatBenchmark net6.0 48.1μs 577ns 5.71μs 0 0 0 44.11 KB
#7441 StringConcatBenchmark netcoreapp3.1 56.1μs 945ns 9.45μs 0 0 0 42.84 KB
#7441 StringConcatBenchmark net472 57.7μs 160ns 597ns 0 0 0 65.54 KB
#7441 StringConcatAspectBenchmark net6.0 455μs 2.19μs 9.04μs 0 0 0 258.94 KB
#7441 StringConcatAspectBenchmark netcoreapp3.1 531μs 2.37μs 8.56μs 0 0 0 274.37 KB
#7441 StringConcatAspectBenchmark net472 404μs 2.04μs 8.89μs 0 0 0 286.72 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.57μs 5.94ns 22.2ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.39μs 17.6ns 84.2ns 0 0 0 1.7 KB
master EnrichedLog net472 4μs 4.14ns 16ns 0.241 0 0 1.64 KB
#7441 EnrichedLog net6.0 2.52μs 12.4ns 52.6ns 0 0 0 1.7 KB
#7441 EnrichedLog netcoreapp3.1 3.32μs 5.42ns 21ns 0 0 0 1.7 KB
#7441 EnrichedLog net472 4.11μs 5.12ns 19.8ns 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 123μs 82.8ns 321ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 127μs 187ns 700ns 0 0 0 4.31 KB
master EnrichedLog net472 168μs 113ns 439ns 0 0 0 4.52 KB
#7441 EnrichedLog net6.0 122μs 46.4ns 180ns 0 0 0 4.31 KB
#7441 EnrichedLog netcoreapp3.1 128μs 209ns 754ns 0 0 0 4.31 KB
#7441 EnrichedLog net472 169μs 821ns 3.67μs 0 0 0 4.51 KB
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 5.03μs 22.9ns 88.8ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 6.62μs 12.9ns 48.2ns 0 0 0 2.26 KB
master EnrichedLog net472 7.39μs 3.66ns 13.7ns 0.297 0 0 2.08 KB
#7441 EnrichedLog net6.0 5.18μs 16.9ns 65.6ns 0 0 0 2.26 KB
#7441 EnrichedLog netcoreapp3.1 6.58μs 4.99ns 19.3ns 0 0 0 2.26 KB
#7441 EnrichedLog net472 7.55μs 10.4ns 40.1ns 0.3 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 1.96μs 9.64ns 43.1ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.54μs 12.8ns 54.1ns 0 0 0 1.2 KB
master SendReceive net472 3.1μs 1.93ns 7.48ns 0.185 0 0 1.2 KB
#7441 SendReceive net6.0 1.98μs 0.432ns 1.67ns 0 0 0 1.2 KB
#7441 SendReceive netcoreapp3.1 2.63μs 13ns 58.3ns 0 0 0 1.2 KB
#7441 SendReceive net472 3.08μs 2.59ns 10ns 0.185 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.06μs 18.6ns 72.1ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.66μs 7.1ns 27.5ns 0 0 0 1.63 KB
master EnrichedLog net472 6.63μs 6.79ns 26.3ns 0.296 0 0 2.03 KB
#7441 EnrichedLog net6.0 4.2μs 8.43ns 31.6ns 0 0 0 1.58 KB
#7441 EnrichedLog netcoreapp3.1 5.88μs 11.2ns 40.5ns 0 0 0 1.63 KB
#7441 EnrichedLog net472 6.6μs 8.6ns 33.3ns 0.296 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 731ns 3.89ns 20.9ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 950ns 0.301ns 1.17ns 0 0 0 576 B
master StartFinishSpan net472 889ns 0.0801ns 0.3ns 0.0894 0 0 578 B
master StartFinishScope net6.0 889ns 4.32ns 17.8ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.14μs 0.501ns 1.94ns 0 0 0 696 B
master StartFinishScope net472 1.09μs 0.593ns 2.3ns 0.104 0 0 658 B
#7441 StartFinishSpan net6.0 751ns 3.55ns 13.3ns 0 0 0 576 B
#7441 StartFinishSpan netcoreapp3.1 945ns 0.233ns 0.904ns 0 0 0 576 B
#7441 StartFinishSpan net472 896ns 0.0464ns 0.167ns 0.0902 0 0 578 B
#7441 StartFinishScope net6.0 911ns 4.57ns 25.1ns 0 0 0 696 B
#7441 StartFinishScope netcoreapp3.1 1.11μs 5.94ns 32.5ns 0 0 0 696 B
#7441 StartFinishScope net472 1.09μs 0.983ns 3.41ns 0.104 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.03μs 1.28ns 4.95ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.35μs 6.39ns 23.9ns 0 0 0 696 B
master RunOnMethodBegin net472 1.36μs 1.18ns 4.55ns 0.102 0 0 658 B
#7441 RunOnMethodBegin net6.0 1.05μs 0.611ns 2.37ns 0 0 0 696 B
#7441 RunOnMethodBegin netcoreapp3.1 1.37μs 6.48ns 25.1ns 0 0 0 696 B
#7441 RunOnMethodBegin net472 1.38μs 0.342ns 1.28ns 0.103 0 0 658 B

@GreenMatan GreenMatan force-pushed the matang/handsoff-config-di branch from c68d1f2 to c42cbea Compare August 27, 2025 11:56
@GreenMatan GreenMatan marked this pull request as ready for review August 27, 2025 11:57
@GreenMatan GreenMatan requested a review from a team as a code owner August 27, 2025 11:57
@GreenMatan GreenMatan requested a review from anna-git August 27, 2025 12:02
@GreenMatan GreenMatan changed the title [HandsOff Config] Decouple native code from DI/ER env vars [Stable Configuration] Decouple native code from DI/ER env vars Aug 27, 2025
@GreenMatan GreenMatan force-pushed the matang/handsoff-config-di branch 3 times, most recently from 6492b8b to 04e7415 Compare August 28, 2025 11:37
Copy link
Contributor

@anna-git anna-git left a comment

Choose a reason for hiding this comment

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

thank you! I left one small NIT comment

const WSTRING exception_replay_enabled = WStr("DD_EXCEPTION_REPLAY_ENABLED");

// Determines if Dynamic Instrumentation should be controlled by Stable Configuration
const WSTRING dynamic_instrumentation_stable_config_enabled = WStr("DD_DYNAMIC_INSTRUMENTATION_MANAGED_ACTIVATION_ENABLED");
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: I think in the naming and in comments we might not want to add any stable configuration notion as this is really just managed activation. Managed activation takes into account multiple configuration sources, datadog.json, appconfig.xml, webconfig.xml, env vars, now hands off configs files, but tomorrow it could potentially be any config sources merged on the managed side that the native side doesn't really need to be aware of. Technically, if we didnt have stable config, it would still work the same, we could read DD_DYNAMIC_INSTRUMENTATION_ENABLED from datadog.json for example and apply it as long as DD_DYNAMIC_INSTRUMENTATION_MANAGED_ACTIVATION_ENABLED is true

CheckIfTrue(GetEnvironmentValue(environment::exception_replay_enabled));
}

bool IsDynamicInstrumentationStableConfigDisabled()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool IsDynamicInstrumentationStableConfigDisabled()
bool IsDynamicInstrumentationManagedActivationDisabled()


bool IsDynamicInstrumentationStableConfigDisabled()
{
CheckIfFalse(GetEnvironmentValue(environment::dynamic_instrumentation_stable_config_enabled));
Copy link
Contributor

@anna-git anna-git Aug 29, 2025

Choose a reason for hiding this comment

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

make sure if the env var isn't defined, we fallback on true but maybe it's the case already as we're testing false, mentioning just in case 😅

@GreenMatan GreenMatan changed the title [Stable Configuration] Decouple native code from DI/ER env vars [Stable Configuration] Keep DI/ER in hot standby Aug 30, 2025
@GreenMatan GreenMatan force-pushed the matang/handsoff-config-di branch from 04e7415 to cd9e31d Compare August 30, 2025 07:15
@GreenMatan GreenMatan force-pushed the matang/handsoff-config-di branch 2 times, most recently from b4f38de to 982e215 Compare September 1, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants