Module: Datadog::OpenFeature::Remote
- Defined in:
- lib/datadog/open_feature/remote.rb
Overview
This module contains the remote configuration functionality for OpenFeature
Constant Summary collapse
- FFE_FLAG_CONFIGURATION_RULES =
1 << 46
- FFE_PRODUCTS =
['FFE_FLAGS'].freeze
- FFE_CAPABILITIES =
[FFE_FLAG_CONFIGURATION_RULES].freeze
Class Method Summary collapse
Class Method Details
.capabilities ⇒ Object
14 15 16 |
# File 'lib/datadog/open_feature/remote.rb', line 14 def capabilities FFE_CAPABILITIES end |
.products ⇒ Object
18 19 20 |
# File 'lib/datadog/open_feature/remote.rb', line 18 def products FFE_PRODUCTS end |
.receivers(telemetry) ⇒ Object
22 23 24 25 26 27 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 |
# File 'lib/datadog/open_feature/remote.rb', line 22 def receivers(telemetry) matcher = Core::Remote::Dispatcher::Matcher::Product.new(FFE_PRODUCTS) receiver = Core::Remote::Dispatcher::Receiver.new(matcher) do |repository, changes| engine = OpenFeature.engine next unless engine changes.each do |change| content = repository[change.path] unless content || change.type == :delete next telemetry.error("OpenFeature: Remote Configuration change is not present on #{change.type}") end # NOTE: In the current RC implementation we immediately apply the configuration, # but that might change if we need to apply patches instead. case change.type when :insert, :update begin # @type var content: Core::Remote::Configuration::Content engine.reconfigure!(read_content(content)) content.applied rescue EvaluationEngine::ReconfigurationError => e content.errored("Error applying OpenFeature configuration: #{e.}") end when :delete # NOTE: For now, we treat deletion as clearing the configuration # In a multi-config scenario, we might track configs per path engine.reconfigure!(nil) end end end [receiver] end |