Module: Datadog::Profiling::Ext::DirMonkeyPatches
- Defined in:
- lib/datadog/profiling/ext/dir_monkey_patches.rb
Overview
Ruby versions before 3.4 have bugs in the Dir class implementation, causing issues such as
https://github.com/DataDog/dd-trace-rb/issues/3450 .
This was fixed upstream in https://bugs.ruby-lang.org/issues/20586 but we use this monkey patch to work around
the issue on legacy versions (it gets applied by Datadog::Profiling::Component).
This monkey patch for the Ruby Dir class works around these bugs for affected Ruby versions by temporarily
blocking the profiler from interrupting system calls.
A lot of these APIs do very similar things -- they're provided by Ruby as helpers so users don't need to keep reimplementing them but share the same underlying buggy code. And so our monkey patches are a bit repetitive as well. We don't DRY out this file to have minimal overhead.
These monkey patches are applied by the profiler when the "dir_interruption_workaround_enabled" setting is enabled. See the profiling settings for more detail.
Class Method Summary collapse
Class Method Details
.apply! ⇒ Object
23 24 25 26 27 28 |
# File 'lib/datadog/profiling/ext/dir_monkey_patches.rb', line 23 def self.apply! ::Dir.singleton_class.prepend(Datadog::Profiling::Ext::DirClassMonkeyPatches) ::Dir.prepend(Datadog::Profiling::Ext::DirInstanceMonkeyPatches) true end |