Class: AmplitudeExperiment::LocalEvaluationConfig

Inherits:
Object
  • Object
show all
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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server_url: DEFAULT_SERVER_URL, server_zone: ServerZone::US, bootstrap: {}, flag_config_polling_interval_millis: 30_000, debug: false, assignment_config: nil, cohort_sync_config: nil) ⇒ LocalEvaluationConfig

Returns a new instance of LocalEvaluationConfig.

Parameters:

  • debug (Boolean) (defaults to: false)

    Set to true to log some extra information to the console.

  • server_url (String) (defaults to: DEFAULT_SERVER_URL)

    The server endpoint from which to request variants.

  • server_zone (String) (defaults to: ServerZone::US)

    Location of the Amplitude data center to get flags and cohorts from, US or EU

  • bootstrap (Hash) (defaults to: {})

    The value of bootstrap.

  • flag_config_polling_interval_millis (long) (defaults to: 30_000)

    The value of flag config polling interval in million seconds.

  • assignment_config (AssignmentConfig) (defaults to: nil)

    Configuration for automatically tracking assignment events after an evaluation.

  • cohort_sync_config (CohortSyncConfig) (defaults to: nil)

    Configuration for downloading cohorts required for flag evaluation



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/experiment/local/config.rb', line 44

def initialize(server_url: DEFAULT_SERVER_URL, server_zone: ServerZone::US, bootstrap: {},
               flag_config_polling_interval_millis: 30_000, debug: false, assignment_config: nil,
               cohort_sync_config: nil)
  @debug = debug || false
  @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_configAssignmentConfig

Configuration for automatically tracking assignment events after an evaluation.

Returns:



31
32
33
# File 'lib/experiment/local/config.rb', line 31

def assignment_config
  @assignment_config
end

#cohort_sync_configCohortSyncConfig

Configuration for downloading cohorts required for flag evaluation

Returns:



35
36
37
# File 'lib/experiment/local/config.rb', line 35

def cohort_sync_config
  @cohort_sync_config
end

#debugBoolean

Set to true to log some extra information to the console.

Returns:

  • (Boolean)

    the value of debug



15
16
17
# File 'lib/experiment/local/config.rb', line 15

def debug
  @debug
end

#flag_config_polling_interval_millislong

The polling interval for flag configs.

Returns:

  • (long)

    the value of flag config polling interval in million seconds



27
28
29
# File 'lib/experiment/local/config.rb', line 27

def flag_config_polling_interval_millis
  @flag_config_polling_interval_millis
end

#server_urlString

The server endpoint from which to request variants.

Returns:

  • (String)

    the value of server url



19
20
21
# File 'lib/experiment/local/config.rb', line 19

def server_url
  @server_url
end

#server_zoneString

Location of the Amplitude data center to get flags and cohorts from, US or EU

Returns:

  • (String)

    the value of server zone



23
24
25
# File 'lib/experiment/local/config.rb', line 23

def server_zone
  @server_zone
end