Skip to content

[Debugger] DEBUG-4637 Fix DI remote enablement - #9344

Merged
dudikeleti merged 4 commits into
masterfrom
dudik/fix-di-remote-enablement
Oct 22, 2026
Merged

dudikeleti merged 4 commits into
masterfrom
dudik/fix-di-remote-enablement

Conversation

@dudikeleti

@dudikeleti dudikeleti commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary of changes

  • Dynamic Instrumentation (DI) enabled only from remote configuration now actually starts when DD_DYNAMIC_INSTRUMENTATION_ENABLED is unset.
  • An explicit false from either the env var or remote configuration keeps DI off.
  • When several APM_TRACING configs are active, their DI, Exception Replay and Code Origin settings are now merged by priority, like the other settings.
  • Updating one APM_TRACING config no longer drops the other active configs that did not change.
  • Tests: one theory replaces the separate DI enabled/disabled unit tests, new merger test for the debugger settings, updated CombineApmTracingConfiguration tests. DebuggerManagerDynamicTests now waits for DI to finish initializing, not just for the instance to be constructed, and waits for log entries before the final memory snapshot.
  • It affects tracer versions 3.28.0 through 3.56.0

Reason for change

  • Remote-only enablement: DebuggerManager created the DynamicInstrumentation instance, recorded it as initialized and reported DI as enabled in telemetry. However, Initialize() only checked the env var, so the instance never subscribed to LIVE_DEBUGGING and never started its uploaders or probe status poller. Probes created in the UI were never applied. Because the manager still counted that instance as started, it ignored later enable requests until restart, even after the config was deleted and added again. The integration test missed this because it waited for "Initializing Dynamic Instrumentation", which the constructor logs even if DI never starts.
  • Several configs (org/env-level enablement): ApmTracingConfigMerger had its own copy of the field merge without the three debugger fields, so merging two or more configs returned them as null. DI is off unless a config says true, so it turned off.
  • Updating one config: remote configuration only delivers files whose content changed; unchanged files are still listed in client_configs but not resent. DynamicConfigurationManager.CombineApmTracingConfiguration cleared all active configs on every update, so changing one config (for example, turning Code Origin off for a service) dropped a wildcard config that enabled DI, and DI turned off.

Implementation details

  • Initialize() now checks DynamicInstrumentationCanBeEnabled && (DynamicSettings.DynamicInstrumentationEnabled ?? DynamicInstrumentationEnabled):
    • an env false sets CanBeEnabled to false, so DI stays off;
    • a remote value overrides the env value when present, so a remote false turns DI off even if the env var is true;
    • with no remote value, the env value decides.
  • DebuggerManager needs no change. It already applies the same precedence before calling Initialize(), and its DynamicInstrumentation property only returns an initialized instance, so once DI starts, later updates and deletes are applied.
  • ApmTracingConfigMerger now uses ApmTracingConfig.MergeLibConfigs (now internal) instead of its own incomplete copy, so one method merges every field.
  • CombineApmTracingConfiguration keeps active configs until they are removed explicitly. RcmSubscriptionManager already reports every applied config that is missing from client_configs as removed, and only forgets an applied config when it reports it, so the active set stays in sync.
  • A setting that no active config sets behaves as before: DI turns off, while Exception Replay and Code Origin keep their current state (only an explicit false disables them).

Test coverage

  • dotnet test tracer/test/Datadog.Trace.Tests/Datadog.Trace.Tests.csproj -f net10.0 --filter "FullyQualifiedName~Datadog.Trace.Tests.Configuration.DynamicConfigurationManagerTests|FullyQualifiedName~Datadog.Trace.Tests.Configuration.ApmTracingConfigMergerTests|FullyQualifiedName~Datadog.Trace.Tests.Debugger.DynamicInstrumentationTests" on 40ba240: 124 passed. This includes:
    • the six rows of DynamicInstrumentationEnablement_ServicesCalledOnlyWhenEnabled: env on; remote on with env unset (the remote-only case); both unset; env off; env off with remote on; env on with remote off;
    • MergeConfigurations_DebuggerSettings_CorrectPriorityMerging: a wildcard config with DI, Exception Replay and Code Origin on, plus a service+env config with Exception Replay off, merges to Exception Replay off and DI and Code Origin on;
    • CombineApmTracingConfiguration_WhenNewConfigIsProvided_KeepsUnchangedConfigs: updating one config keeps the other active config.
  • DebuggerManagerDynamicTests (integration) not run locally.

Other details

@dudikeleti
dudikeleti requested a review from a team as a code owner October 1, 2026 05:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T05:58:49.276205Z 1c26a0a PR opened
🔒 Security Review ✅ Completed 2026-10-01T06:00:32.216123Z 1c26a0a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dudikeleti
dudikeleti requested a balanced review from Copilot and removed request for a team October 1, 2026 05:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The enablement precedence is correctly implemented and covered by focused unit and integration tests.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes Dynamic Instrumentation startup when enabled through remote configuration while preserving explicit disablement precedence.

Changes:

  • Computes effective DI enablement from local and remote settings.
  • Expands unit coverage across enablement combinations.
  • Makes integration tests wait for completed initialization before snapshots.
File Description
tracer/​src/​Datadog.Trace/​Debugger/​DynamicInstrumentation.cs Applies effective local/remote enablement during initialization.
tracer/​test/​Datadog.Trace.Tests/​Debugger/​DynamicInstrumentationTests.cs Adds matrix-based enablement tests.
tracer/​test/​Datadog.Trace.Debugger.IntegrationTests/​DebuggerManagerDynamicTests.cs Waits for expected lifecycle logs before final assertions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@pr-commenter

pr-commenter Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-10-01 11:10:24

Comparing candidate commit 40ba240 in PR branch dudik/fix-di-remote-enablement with baseline commit b6c4297 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 11 performance regressions! Performance is the same for 61 metrics, 0 unstable metrics, 71 known flaky benchmarks, 52 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery net472

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+10.133%; +10.144%]
  • 🟥 throughput [-31588.318op/s; -28926.720op/s] or [-8.897%; -8.147%]

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery net6.0

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.750%; +9.761%]

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.830%; +9.841%]
  • 🟥 throughput [-36782.601op/s; -28323.326op/s] or [-9.092%; -7.001%]

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync net472

  • 🟥 allocated_mem [+271 bytes; +272 bytes] or [+9.338%; +9.348%]
  • 🟥 throughput [-11583.915op/s; -11190.705op/s] or [-13.224%; -12.775%]

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync net6.0

  • 🟥 allocated_mem [+199 bytes; +200 bytes] or [+9.426%; +9.438%]
  • 🟥 throughput [-9094.841op/s; -7895.284op/s] or [-6.178%; -5.363%]

scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync netcoreapp3.1

  • 🟥 allocated_mem [+199 bytes; +200 bytes] or [+7.569%; +7.581%]
  • 🟥 throughput [-12756.371op/s; -11333.937op/s] or [-10.123%; -8.994%]

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-9364.606op/s; -8853.032op/s] or [-11.104%; -10.497%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0

  • 🟥 throughput [-9260.142op/s; -6591.429op/s] or [-7.784%; -5.540%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1

  • 🟥 throughput [-11445.761op/s; -10177.819op/s] or [-11.638%; -10.349%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 allocated_mem [+1.605KB; +1.605KB] or [+48.760%; +48.776%]
  • 🟥 execution_time [+305.992ms; +308.258ms] or [+151.844%; +152.968%]
  • 🟥 throughput [-54.456op/s; -50.506op/s] or [-9.798%; -9.087%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 allocated_mem [+1.011KB; +1.011KB] or [+37.485%; +37.498%]
  • 🟥 execution_time [+376.396ms; +380.643ms] or [+297.376%; +300.731%]
  • 🟩 throughput [+61.881op/s; +68.796op/s] or [+8.159%; +9.070%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 allocated_mem [+1.090KB; +1.090KB] or [+40.417%; +40.429%]
  • 🟥 execution_time [+398.909ms; +400.916ms] or [+353.020%; +354.795%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net472

  • 🟥 allocated_mem [+4.758KB; +4.758KB] or [+100.159%; +100.174%]
  • 🟥 throughput [-61333.586op/s; -60968.336op/s] or [-47.721%; -47.436%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟥 allocated_mem [+3.880KB; +3.880KB] or [+82.058%; +82.072%]
  • 🟩 execution_time [-15.907ms; -11.735ms] or [-7.429%; -5.481%]
  • 🟥 throughput [-61617.382op/s; -58860.341op/s] or [-44.977%; -42.965%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+4.608KB; +4.608KB] or [+99.641%; +99.654%]
  • 🟥 throughput [-49437.991op/s; -47173.871op/s] or [-44.698%; -42.651%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net472

  • 🟥 allocated_mem [+1.380KB; +1.380KB] or [+111.648%; +111.662%]
  • 🟥 throughput [-299218.923op/s; -296075.789op/s] or [-30.552%; -30.231%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0

  • 🟥 allocated_mem [+543 bytes; +544 bytes] or [+44.437%; +44.446%]
  • 🟩 execution_time [-25.698ms; -20.764ms] or [-11.460%; -9.260%]
  • 🟥 throughput [-102758.244op/s; -80076.233op/s] or [-10.978%; -8.555%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 allocated_mem [+1.344KB; +1.344KB] or [+111.253%; +111.267%]
  • 🟥 throughput [-170341.369op/s; -153774.783op/s] or [-24.475%; -22.094%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472

  • 🟥 allocated_mem [+3.378KB; +3.378KB] or [+89.003%; +89.017%]
  • 🟥 throughput [-74560.653op/s; -73476.340op/s] or [-50.178%; -49.449%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0

  • 🟥 allocated_mem [+3.336KB; +3.336KB] or [+88.150%; +88.161%]
  • 🟥 throughput [-75166.329op/s; -72284.926op/s] or [-47.827%; -45.994%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+3.264KB; +3.264KB] or [+88.493%; +88.506%]
  • 🟥 throughput [-56717.743op/s; -54098.344op/s] or [-45.183%; -43.096%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 throughput [+259083.862op/s; +309103.865op/s] or [+8.639%; +10.307%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1

  • 🟩 execution_time [-18.999ms; -14.668ms] or [-8.758%; -6.761%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472

  • 🟩 allocated_mem [-13.759KB; -13.756KB] or [-42.324%; -42.316%]
  • 🟥 execution_time [+300.429ms; +301.195ms] or [+150.114%; +150.497%]
  • 🟩 throughput [+972.405op/s; +990.621op/s] or [+10.740%; +10.941%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net6.0

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+298.145ms; +301.809ms] or [+150.355%; +152.203%]
  • 🟩 throughput [+2192.800op/s; +2421.831op/s] or [+16.772%; +18.523%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs netcoreapp3.1

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+300.116ms; +302.549ms] or [+151.175%; +152.401%]
  • 🟩 throughput [+1825.729op/s; +1952.045op/s] or [+17.627%; +18.846%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net472

  • 🟥 execution_time [+296.555ms; +297.197ms] or [+145.656%; +145.972%]
  • 🟩 throughput [+544.975op/s; +555.435op/s] or [+14.447%; +14.725%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟥 execution_time [+296.804ms; +299.765ms] or [+145.097%; +146.544%]
  • 🟩 throughput [+2730.237op/s; +2798.905op/s] or [+39.665%; +40.663%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟥 execution_time [+301.826ms; +302.962ms] or [+150.852%; +151.420%]
  • 🟩 throughput [+1398.535op/s; +1428.298op/s] or [+27.760%; +28.351%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472

  • 🟩 execution_time [-142.662µs; -136.990µs] or [-29.290%; -28.126%]
  • 🟩 throughput [+807.611op/s; +849.418op/s] or [+39.334%; +41.371%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0

  • 🟩 execution_time [-123.179µs; -96.315µs] or [-28.251%; -22.090%]
  • 🟩 throughput [+703.694op/s; +829.220op/s] or [+30.594%; +36.051%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1

  • 🟩 execution_time [-136.775µs; -114.429µs] or [-29.304%; -24.517%]
  • 🟩 throughput [+722.277op/s; +811.156op/s] or [+33.342%; +37.445%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472

  • 🟩 execution_time [-126.965µs; -122.311µs] or [-34.280%; -33.023%]
  • 🟩 throughput [+1342.605op/s; +1400.207op/s] or [+49.724%; +51.857%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net6.0

  • 🟩 execution_time [-87.380µs; -60.046µs] or [-27.896%; -19.170%]
  • 🟩 throughput [+865.998op/s; +1134.526op/s] or [+26.996%; +35.367%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1

  • 🟩 execution_time [-123.954µs; -98.094µs] or [-33.909%; -26.835%]
  • 🟩 throughput [+1067.896op/s; +1262.385op/s] or [+38.323%; +45.302%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • 🟥 execution_time [+416.745ms; +424.721ms] or [+452.810%; +461.477%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • unstable execution_time [+250.487ms; +312.224ms] or [+190.193%; +237.069%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+323.206ms; +392.972ms] or [+148.607%; +180.685%]
  • 🟥 throughput [-603.910op/s; -551.424op/s] or [-54.720%; -49.964%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • unstable execution_time [+209.275ms; +342.539ms] or [+89.184%; +145.976%]
  • 🟥 throughput [-676.113op/s; -592.390op/s] or [-45.097%; -39.513%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 allocated_mem [+2.141KB; +2.145KB] or [+5.056%; +5.064%]
  • 🟥 execution_time [+335.230ms; +344.189ms] or [+200.506%; +205.865%]
  • 🟥 throughput [-412.901op/s; -375.136op/s] or [-28.750%; -26.120%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0

  • 🟩 throughput [+47.707op/s; +58.670op/s] or [+5.144%; +6.326%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0

  • 🟩 execution_time [-184.495µs; -154.414µs] or [-9.346%; -7.822%]
  • 🟩 throughput [+43.945op/s; +52.039op/s] or [+8.675%; +10.273%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1

  • 🟥 execution_time [+361.982µs; +422.826µs] or [+9.180%; +10.723%]
  • 🟥 throughput [-24.394op/s; -21.227op/s] or [-9.620%; -8.370%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 allocated_mem [+96 bytes; +97 bytes] or [+12.092%; +12.103%]
  • 🟥 execution_time [+303.236ms; +305.421ms] or [+152.704%; +153.804%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+12.114%; +12.124%]
  • 🟥 execution_time [+299.414ms; +302.512ms] or [+150.037%; +151.589%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+12.114%; +12.124%]
  • 🟥 execution_time [+302.907ms; +306.107ms] or [+152.168%; +153.775%]
  • 🟥 throughput [-33980.150op/s; -26578.682op/s] or [-7.158%; -5.599%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+11.165%; +11.177%]
  • 🟥 execution_time [+299.743ms; +301.514ms] or [+150.521%; +151.410%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+12.493%; +12.506%]
  • 🟥 execution_time [+299.150ms; +301.643ms] or [+147.916%; +149.149%]
  • 🟥 throughput [-59767.006op/s; -51787.376op/s] or [-9.630%; -8.344%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+11.422%; +11.434%]
  • 🟥 execution_time [+299.417ms; +303.580ms] or [+151.758%; +153.868%]
  • 🟥 throughput [-49949.945op/s; -39769.402op/s] or [-10.786%; -8.588%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 allocated_mem [+96 bytes; +97 bytes] or [+11.197%; +11.208%]
  • 🟥 execution_time [+302.175ms; +304.643ms] or [+151.664%; +152.903%]
  • 🟥 throughput [-34902.138op/s; -32911.890op/s] or [-9.054%; -8.538%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+10.618%; +10.631%]
  • 🟥 execution_time [+299.836ms; +302.866ms] or [+149.441%; +150.951%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+10.618%; +10.631%]
  • 🟥 execution_time [+300.397ms; +303.628ms] or [+149.445%; +151.052%]
  • 🟥 throughput [-37296.627op/s; -30495.901op/s] or [-8.828%; -7.218%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472

  • 🟥 allocated_mem [+96 bytes; +97 bytes] or [+6.002%; +6.011%]
  • 🟥 throughput [-20377.425op/s; -18945.546op/s] or [-8.194%; -7.619%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+5.627%; +5.636%]
  • 🟩 execution_time [-16.105ms; -12.362ms] or [-7.489%; -5.748%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+5.605%; +5.617%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472

  • unstable execution_time [+13.936µs; +57.266µs] or [+3.442%; +14.145%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0

  • 🟩 allocated_mem [-18.635KB; -18.613KB] or [-6.798%; -6.789%]
  • unstable execution_time [-29015.050ns; +29529.809ns] or [-5.735%; +5.836%]
  • unstable throughput [-103.855op/s; +100.810op/s] or [-5.182%; +5.030%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1

  • 🟩 allocated_mem [-15.204KB; -15.182KB] or [-5.543%; -5.535%]
  • unstable execution_time [-49.627µs; +12.010µs] or [-8.600%; +2.081%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • unstable execution_time [+6.948µs; +11.206µs] or [+16.424%; +26.488%]
  • 🟥 throughput [-5073.351op/s; -3260.021op/s] or [-21.357%; -13.724%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1

  • unstable execution_time [-13.298µs; -4.884µs] or [-20.632%; -7.577%]
  • unstable throughput [+1247.085op/s; +3080.404op/s] or [+7.651%; +18.899%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+303.414ms; +304.512ms] or [+153.362%; +153.917%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+303.838ms; +306.320ms] or [+154.652%; +155.916%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+298.738ms; +302.032ms] or [+149.555%; +151.204%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.197%; +9.208%]
  • 🟥 throughput [-44105.058op/s; -39855.524op/s] or [-12.209%; -11.033%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.226%; +9.238%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+9.226%; +9.238%]
  • 🟥 throughput [-38540.506op/s; -30007.658op/s] or [-9.121%; -7.102%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+297.406ms; +299.530ms] or [+148.230%; +149.289%]
  • 🟥 throughput [-13185.645op/s; -11842.354op/s] or [-8.707%; -7.820%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0

  • 🟥 allocated_mem [+96 bytes; +96 bytes] or [+6.000%; +6.010%]
  • 🟥 execution_time [+301.252ms; +302.188ms] or [+151.275%; +151.744%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+5.819%; +5.828%]
  • 🟥 execution_time [+300.918ms; +303.327ms] or [+152.606%; +153.828%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0

  • unstable execution_time [+336.852ms; +392.473ms] or [+418.935%; +488.109%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟥 execution_time [+299.544ms; +300.463ms] or [+149.406%; +149.864%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472

  • 🟥 allocated_mem [+31 bytes; +32 bytes] or [+5.244%; +5.256%]
  • 🟥 throughput [-60663.037op/s; -56098.033op/s] or [-6.770%; -6.261%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472

  • 🟥 allocated_mem [+31 bytes; +32 bytes] or [+6.037%; +6.047%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0

  • 🟥 allocated_mem [+31 bytes; +32 bytes] or [+6.057%; +6.065%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1

  • 🟥 allocated_mem [+31 bytes; +32 bytes] or [+6.059%; +6.069%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+15.733%; +15.745%]
  • 🟥 throughput [-70369.557op/s; -65709.713op/s] or [-10.299%; -9.617%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

  • 🟥 allocated_mem [+95 bytes; +96 bytes] or [+14.810%; +14.821%]
  • 🟥 throughput [-60705.698op/s; -45976.693op/s] or [-8.476%; -6.420%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1

@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

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

✅ No regressions detected

📄 View the full report (charts + all metrics) →

dudikeleti added a commit to DataDog/system-tests that referenced this pull request Oct 1, 2026
DEBUG-4637 is fixed in dd-trace-dotnet 3.55.0 (DataDog/dd-trace-dotnet#9344). .NET has code origin on by default since 3.45.0, so the code origin test now expects it enabled at startup, as for Node.js.
…nges

Remote config only delivers new or changed files, so clearing the active set on
every update dropped configs that are still listed in client_configs. Removals
are already reported explicitly, so rely on those.
@dudikeleti
dudikeleti requested a balanced review from Copilot and removed request for zacharycmontoya October 1, 2026 10:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

An explicit remote false still cannot disable DI when the environment setting is true because DebuggerManager uses different precedence.

Review effort: Balanced
Findings: 1 High severity

Open (1)

@dudikeleti
dudikeleti requested a review from jpbempel October 1, 2026 14:44
@dudikeleti
dudikeleti enabled auto-merge (squash) October 15, 2026 23:31
@lucaspimentel

Copy link
Copy Markdown
Member

@DataDog review

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bits Code Review: PASS

More details

DI startup now follows DebuggerManager’s existing remote/environment precedence. Retaining unchanged APM_TRACING configs is consistent with explicit removal handling, and the completed static review identified no reportable defects.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 40ba240

@andreimatei

Copy link
Copy Markdown
Contributor

Please make sure that probes are removed when DI is disabled remotely. When investigating something across tracers, my clunkers claim that they wouldn't be.

@dudikeleti

Copy link
Copy Markdown
Contributor Author

Please make sure that probes are removed when DI is disabled remotely. When investigating something across tracers, my clunkers claim that they wouldn't be.

This is a known gap that was intentionally left out of scope, as complete probe removal requires additional work and thorough testing. For now, remote disable stops probe processing without fully reverting the instrumentation.

Native removal involves waiting for Revert/ReJIT to complete and requires careful handling of concurrency, locking, process shutdown, rapid disable/re-enable, and preserving Exception Replay probes on shared methods.

I'll address this in a separate PR with dedicated lifecycle tests.

@dudikeleti
dudikeleti merged commit 3efb8ef into master Oct 22, 2026
150 checks passed
@dudikeleti
dudikeleti deleted the dudik/fix-di-remote-enablement branch October 22, 2026 16:33
@github-actions github-actions Bot added this to the vNext-v3 milestone Oct 22, 2026
dudikeleti added a commit to DataDog/system-tests that referenced this pull request Oct 27, 2026
DataDog/dd-trace-dotnet#9344 merged after 3.56.0 was released, so the first release with the fix is 3.57.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dudikeleti added a commit to DataDog/system-tests that referenced this pull request Oct 27, 2026
DataDog/dd-trace-dotnet#9344 merged after 3.56.0 was released, so the first release with the fix is 3.57.0.

Code origin enablement doesn't depend on #9344 and is enabled from 3.56.0 in #8123, so this PR no longer touches it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dudikeleti added a commit to DataDog/system-tests that referenced this pull request Oct 27, 2026
…as a bug

The start_time filter only read the top-level timestamp of a snapshot
payload. .NET only sets it in the snapshot itself, so the filter never
applied, and the apm_multiconfig setup matched the simple exception
snapshot captured by the previous test while exception replay was off.
Fall back to the snapshot timestamp.

Test_Debugger_InProduct_Enablement_Dynamic_Instrumentation stays
bug (DEBUG-4637): with DataDog/dd-trace-dotnet#9344 in the dev build,
remote enablement installs the probe, but it never emits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dudikeleti added a commit to DataDog/system-tests that referenced this pull request Oct 27, 2026
…from 3.57.0

ASP.NET Core MVC calls actions through a compiled expression tree, and
the JIT inlines the 12-byte LogProbe into it on the first /debugger/log
request. The in-product DI test calls /debugger/log while DI is off, so
after remote enablement the tracer ReJITs LogProbe but requests keep
running the inlined copy, and the line probe never emits. Scenarios that
enable DI at startup install the probe before the first call.

Mark LogProbe NoInlining on its existing attribute line so no line
number in the file moves, and declare the DI test bug (DEBUG-4637) only
below 3.57.0, the first release with DataDog/dd-trace-dotnet#9344.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dudikeleti added a commit that referenced this pull request Oct 30, 2026
…otely (#9560)

## Summary of changes

- When Dynamic Instrumentation (DI) is turned off at runtime by remote
configuration (APM_TRACING `dynamic_instrumentation_enabled: false`, or
the config that enabled it is removed), the installed probes are now
removed and the instrumented methods go back to their original code.
- When DI is turned on again, the probes are installed again and keep
working.
- Process shutdown still only disposes DI, without reverting.

## Reason for change

- Follow-up to the review comment on #9344: "Please make sure that
probes are removed when DI is disabled remotely".
- Disabling DI only disposed the `DynamicInstrumentation` instance and
never asked the native tracer to revert the instrumented methods. While
DI was off, span probes kept creating `dd.dynamic.span` spans, span
decoration probes kept adding tags, and log, metric and snapshot probes
kept capturing on every hit and then dropping the result.
- Java, Python, PHP and Ruby already uninstall all probes when DI is
disabled remotely.

## Implementation details

- New `DynamicInstrumentation.RemoveProbesAndDispose()` reverts the
native instrumentation of every probe with a native representation, then
disposes the instance. It holds `_instanceLock` until disposal, so a
concurrent probe update can't instrument a method after the revert.
- `DebuggerManager.DisableDynamicInstrumentation` calls it for every
runtime disable, immediate or debounced. If process exit has already
started, it only disposes.
- Unlike deleting a probe in the UI, disabling DI keeps the probe
processors and samplers registered. `ProbeDataCollection` caches them by
native probe index and probe ID, and the native side usually gives a
probe that is added again the same index. Removing them left re-enabled
log and snapshot probes with a removed processor and a disposed sampler
that never refills its budget, so they stopped capturing. Kept, they are
updated in place when the probes are added again. A TODO in the code
tracks clearing those cache entries on removal instead.
- No new lock order: `Dispose` already ran under `_syncLock`, and hot
paths don't take these locks.

## Test coverage

- Unit (`DynamicInstrumentationTests.ProbeRemovalOnDisableTests`):
- a remote disable reverts every installed probe (remote `false`, config
removed, env `true` with remote `false`);
- after a disable and re-enable, the cached `ProbeData` uses the
registered processor and sampler;
- later probe updates are ignored; shutdown, and a disable after process
exit started, don't revert.
- Integration
(`ProbesTests.SpanProbeIsRemovedWhenDynamicInstrumentationIsDisabledRemotely`,
DI enabled by env var or remotely): a span probe creates a span, DI is
disabled remotely, then re-enabled; exactly two probe spans must arrive
across the three runs.
- Before the fixes, the remote-disable unit tests and the integration
test failed; the cached `ProbeData` test failed on f28d359.
- With c9122ee, on Windows x64, all pass: the Debugger and dynamic
configuration unit tests on net10.0 (960 passed) and net48 (950 passed),
and the integration tests on net8.0 (new test,
`LineProbesWithRevertTest`, `ConditionAndTemplateChangeTest`) and net48
(new test, `DebuggerManagerDynamicTests`, `LineProbesWithRevertTest`).
- Not run on Linux locally.

## Other details

- System test: DataDog/system-tests#8229 (draft) checks that probes are
removed when DI is disabled remotely. The existing in-product DI test
only checks that probes stop emitting, which passes in .NET even with
this bug.

<!-- Fixes #{issue} -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants