Method: Datadog::DI.activate_tracking
- Defined in:
- lib/datadog/di/base.rb
.activate_tracking ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Activates code tracking if possible.
This method does nothing if invoked in an environment that does not implement required trace points for code tracking (MRI Ruby < 2.6, JRuby) and rescues any exceptions that may be raised by downstream DI code.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/datadog/di/base.rb', line 41 def activate_tracking # :script_compiled trace point was added in Ruby 2.6. return unless RUBY_VERSION >= '2.6' begin # Activate code tracking by default because line trace points will not work # without it. Datadog::DI.activate_tracking! rescue => exc if defined?(Datadog.logger) Datadog.logger.warn { "di: Failed to activate code tracking for DI: #{exc.class}: #{exc}" } else # We do not have Datadog logger potentially because DI code tracker is # being loaded early in application boot process and the rest of datadog # wasn't loaded yet. Output to standard error. warn("datadog: di: Failed to activate code tracking for DI: #{exc.class}: #{exc}") end end end |