Module: Datadog::OpenFeature::Exposures::Event
- Defined in:
- lib/datadog/open_feature/exposures/event.rb
Overview
A data model for an exposure event
Constant Summary collapse
- TARGETING_KEY_FIELD =
'targeting_key'- ALLOWED_FIELD_TYPES =
[String, Integer, Float, TrueClass, FalseClass].freeze
Class Method Summary collapse
- .build(result, flag_key:, context:) ⇒ Object
- .cache_key(result, flag_key:, context:) ⇒ Object
- .cache_value(result, flag_key:, context:) ⇒ Object
Class Method Details
.build(result, flag_key:, context:) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/datadog/open_feature/exposures/event.rb', line 22 def build(result, flag_key:, context:) { timestamp: , allocation: { key: result.allocation_key }, flag: { key: flag_key }, variant: { key: result.variant }, subject: { id: context.targeting_key, attributes: extract_attributes(context) } }.freeze end |
.cache_key(result, flag_key:, context:) ⇒ Object
14 15 16 |
# File 'lib/datadog/open_feature/exposures/event.rb', line 14 def cache_key(result, flag_key:, context:) "#{flag_key}:#{context.targeting_key}" end |
.cache_value(result, flag_key:, context:) ⇒ Object
18 19 20 |
# File 'lib/datadog/open_feature/exposures/event.rb', line 18 def cache_value(result, flag_key:, context:) "#{result.allocation_key}:#{result.variant}" end |