Module: Datadog::DI::Remote Private
- Defined in:
- lib/datadog/di/remote.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Provides an interface expected by the core Remote subsystem to receive DI-specific remote configuration.
In order to apply (i.e., act on) the configuration, we need the state stored under DI Component. Thus, this module forwards actual configuration application to the ProbeManager associated with the global DI Component.
Constant Summary collapse
- PRODUCT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'LIVE_DEBUGGING'
Class Method Summary collapse
- .capabilities ⇒ Object private
- .products ⇒ Object private
- .receiver(products = [PRODUCT], &block) ⇒ Object private
- .receivers(telemetry) ⇒ Object private
Class Method Details
.capabilities ⇒ 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.
24 25 26 |
# File 'lib/datadog/di/remote.rb', line 24 def capabilities [] end |
.products ⇒ 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.
18 19 20 21 22 |
# File 'lib/datadog/di/remote.rb', line 18 def products # TODO: do not send our product on unsupported runtimes # (Ruby 2.5 / JRuby) [PRODUCT] end |
.receiver(products = [PRODUCT], &block) ⇒ 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.
63 64 65 66 |
# File 'lib/datadog/di/remote.rb', line 63 def receiver(products = [PRODUCT], &block) matcher = Core::Remote::Dispatcher::Matcher::Product.new(products) [Core::Remote::Dispatcher::Receiver.new(matcher, &block)] end |
.receivers(telemetry) ⇒ 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.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/datadog/di/remote.rb', line 28 def receivers(telemetry) receiver do |repository, changes| # DEV: Filter our by product. Given it will be very common # DEV: we can filter this out before we receive the data in this method. # DEV: Apply this refactor to AppSec as well if implemented. component = DI.component # We should always have a non-nil DI component here, because we # only add DI product to remote config request if DI is enabled. # Ideally, we should be injected with the DI component here # rather than having to retrieve it from global state. # If the component is nil for some reason, we also don't have a # logger instance to report the issue. if component changes.each do |change| case change.type when :insert add_probe(change.content, component) when :update # We do not implement updates at the moment, remove the # probe and reinstall. remove_probe(change.content, component) add_probe(change.content, component) when :delete remove_probe(change.previous, component) else # This really should never happen since we generate the # change types in the library. component.logger.debug { "di: unrecognized change type: #{change.type}" } end end end end end |