Class: AmplitudeExperiment::LocalEvaluationConfig
- Inherits:
-
Object
- Object
- AmplitudeExperiment::LocalEvaluationConfig
- Defined in:
- lib/experiment/local/config.rb
Overview
LocalEvaluationConfig
Constant Summary collapse
- DEFAULT_SERVER_URL =
Default server url
'https://api.lab.amplitude.com'.freeze
- EU_SERVER_URL =
'https://flag.lab.eu.amplitude.com'.freeze
- DEFAULT_LOGDEV =
$stdout- DEFAULT_LOG_LEVEL =
Logger::ERROR
Instance Attribute Summary collapse
-
#assignment_config ⇒ AssignmentConfig
Configuration for automatically tracking assignment events after an evaluation.
-
#cohort_sync_config ⇒ CohortSyncConfig
Configuration for downloading cohorts required for flag evaluation.
-
#debug ⇒ Boolean
Set to true to log some extra information to the console.
-
#flag_config_polling_interval_millis ⇒ long
The polling interval for flag configs.
-
#logger ⇒ Logger
Set the client logger to a user defined [Logger].
-
#server_url ⇒ String
The server endpoint from which to request variants.
-
#server_zone ⇒ String
Location of the Amplitude data center to get flags and cohorts from, US or EU.
Instance Method Summary collapse
-
#initialize(server_url: DEFAULT_SERVER_URL, server_zone: ServerZone::US, bootstrap: {}, flag_config_polling_interval_millis: 30_000, debug: false, logger: nil, assignment_config: nil, cohort_sync_config: nil) ⇒ LocalEvaluationConfig
constructor
A new instance of LocalEvaluationConfig.
Constructor Details
#initialize(server_url: DEFAULT_SERVER_URL, server_zone: ServerZone::US, bootstrap: {}, flag_config_polling_interval_millis: 30_000, debug: false, logger: nil, assignment_config: nil, cohort_sync_config: nil) ⇒ LocalEvaluationConfig
Returns a new instance of LocalEvaluationConfig.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/experiment/local/config.rb', line 53 def initialize(server_url: DEFAULT_SERVER_URL, server_zone: ServerZone::US, bootstrap: {}, flag_config_polling_interval_millis: 30_000, debug: false, logger: nil, assignment_config: nil, cohort_sync_config: nil) @logger = logger if logger.nil? @logger = Logger.new(DEFAULT_LOGDEV) @logger.level = debug ? Logger::DEBUG : DEFAULT_LOG_LEVEL end @server_url = server_url @server_zone = server_zone @cohort_sync_config = cohort_sync_config if server_url == DEFAULT_SERVER_URL && @server_zone == ServerZone::EU @server_url = EU_SERVER_URL @cohort_sync_config.cohort_server_url = EU_COHORT_SYNC_URL if @cohort_sync_config && @cohort_sync_config.cohort_server_url == DEFAULT_COHORT_SYNC_URL end @bootstrap = bootstrap @flag_config_polling_interval_millis = flag_config_polling_interval_millis @assignment_config = assignment_config end |
Instance Attribute Details
#assignment_config ⇒ AssignmentConfig
Configuration for automatically tracking assignment events after an evaluation.
39 40 41 |
# File 'lib/experiment/local/config.rb', line 39 def assignment_config @assignment_config end |
#cohort_sync_config ⇒ CohortSyncConfig
Configuration for downloading cohorts required for flag evaluation
43 44 45 |
# File 'lib/experiment/local/config.rb', line 43 def cohort_sync_config @cohort_sync_config end |
#debug ⇒ Boolean
Set to true to log some extra information to the console.
19 20 21 |
# File 'lib/experiment/local/config.rb', line 19 def debug @debug end |
#flag_config_polling_interval_millis ⇒ long
The polling interval for flag configs.
35 36 37 |
# File 'lib/experiment/local/config.rb', line 35 def flag_config_polling_interval_millis @flag_config_polling_interval_millis end |
#logger ⇒ Logger
Set the client logger to a user defined [Logger]
23 24 25 |
# File 'lib/experiment/local/config.rb', line 23 def logger @logger end |
#server_url ⇒ String
The server endpoint from which to request variants.
27 28 29 |
# File 'lib/experiment/local/config.rb', line 27 def server_url @server_url end |
#server_zone ⇒ String
Location of the Amplitude data center to get flags and cohorts from, US or EU
31 32 33 |
# File 'lib/experiment/local/config.rb', line 31 def server_zone @server_zone end |