Method: Datadog::DI.current_component
- Defined in:
- lib/datadog/di/base.rb
.current_component ⇒ 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.
DI code tracker is instantiated globally before the regular set of components is created, but the code tracker needs to call out to the “current” DI component to perform instrumentation when application code is loaded. Because this call may happen prior to Datadog components having been initialized, we maintain the “current component” which contains a reference to the most recently instantiated DI::Component. This way, if a DI component hasn’t been instantiated, we do not try to reference Datadog.components. In other words, this method exists so that we never attempt to call Datadog.components from the code tracker.
89 90 91 92 93 |
# File 'lib/datadog/di/base.rb', line 89 def current_component LOCK.synchronize do @current_components&.last end end |