Class: Quonfig::Telemetry::ContextShape

Inherits:
Object
  • Object
show all
Defined in:
lib/quonfig/telemetry/context_shape.rb

Overview

Maps a context property value to the numeric field-type code used by api-telemetry. The numbers match the codes used by sdk-node and sdk-go (and historically the Prefab proto ConfigValue oneof):

1  = integer
2  = string
4  = double (float)
5  = boolean
10 = string list (array)

Constant Summary collapse

MAPPING =
{
  Integer => 1,
  String => 2,
  Float => 4,
  TrueClass => 5,
  FalseClass => 5,
  Array => 10
}.freeze
DEFAULT =

We default to 2 (String) for unknown types — criteria evaluation treats them as strings via #to_s.

MAPPING[String]

Class Method Summary collapse

Class Method Details

.field_type_number(value) ⇒ Object



28
29
30
# File 'lib/quonfig/telemetry/context_shape.rb', line 28

def self.field_type_number(value)
  MAPPING.fetch(value.class, DEFAULT)
end