DI: do not advertise LIVE_DEBUGGING on unsupported runtimes#5956
DI: do not advertise LIVE_DEBUGGING on unsupported runtimes#5956p-datadog wants to merge 1 commit into
Conversation
Resolves the TODO in DI::Remote.products. With always-build (#5525) the DI remote-config block registers the LIVE_DEBUGGING product and the implicit-enablement capability (bit 38) whenever DI is not explicitly disabled — including on JRuby and Ruby 2.5, where DI can never run. The backend would then send probe configs and enable signals the tracer silently drops. Gate the DI registration block on a new platform check, Datadog::DI.supported_runtime? (MRI on Ruby 2.6+), which is the platform-support subset of DI.unsupported_reason. It deliberately omits the C-extension check so behaviour does not depend on a build artifact that is always present in shipped gems on supported runtimes. Tests: capabilities_spec gains an unsupported-runtime context (DI not registered even when enabled); di_spec covers supported_runtime? across MRI 2.6+, JRuby, and MRI < 2.6.
BenchmarksBenchmark execution time: 2026-06-25 16:35:20 Comparing candidate commit 30b3186 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 48 metrics, 1 unstable metrics.
|
What does this PR do?
Resolves the long-standing TODO in
Datadog::DI::Remote.products— the tracer no longer advertises theLIVE_DEBUGGINGremote-config product (or the implicit-enablement capability, bit 38) on runtimes where Dynamic Instrumentation can never run (JRuby, Ruby 2.5).The DI registration block in
Core::Remote::Client::Capabilities#registernow also requiresDatadog::DI.supported_runtime?:Datadog::DI.supported_runtime?is the platform-support subset ofDI.unsupported_reason—RUBY_ENGINE == 'ruby' && Datadog::RubyVersion.is?('>= 2.6'). It deliberately excludes the C-extension and configuration checks so it can be evaluated without settings and without depending on a build artifact (the compiled extension is always present in shipped gems on supported runtimes; gating on it would couple registration to the build and breakspec:mainwhere the extension is not compiled).Motivation:
This is a follow-up to #5525 (implicit DI enablement via remote configuration). With always-build, the DI remote-config block registers
LIVE_DEBUGGINGand bit 38 whenever DI is not explicitly disabled — including for default-off customers on JRuby and Ruby 2.5. On those runtimesComponent.buildreturns nil andDI::Remote.receiversdrops every change, so the backend would send probe configs and enable signals the tracer silently discards, and the service could appear DI-capable in the Live Debugger UI when it is not.Change log entry
None. Refines the unreleased implicit-enablement feature (#5525); its customer-facing changelog entry lives in that PR.
Additional Notes:
Stacked on
#5525(base branchenablement) because the fix builds on that PR's always-build structure (CAPABILITIES,explicitly_disabled?, the gated registration block). Rebase ontomasterand retarget the base once #5525 merges.Draft pending #5525.
How to test the change?
New coverage:
capabilities_spec.rb— an "unsupported runtime (JRuby or Ruby 2.5)" context asserting DI capabilities, product, and receivers are NOT registered even when DI is enabled; existing DI-registration contexts stubsupported_runtime?to remain deterministic across the Ruby matrix.di_spec.rb—.supported_runtime?across MRI 2.6+ (true), JRuby (false), and MRI < 2.6 (false).bundle exec rake standard typecheckclean.