Class: AmplitudeExperiment::RemoteEvaluationConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/experiment/remote/config.rb

Overview

Configuration

Constant Summary collapse

DEFAULT_SERVER_URL =

Default server url

'https://api.lab.amplitude.com'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(debug: false, server_url: DEFAULT_SERVER_URL, fetch_timeout_millis: 10_000, fetch_retries: 0, fetch_retry_backoff_min_millis: 500, fetch_retry_backoff_max_millis: 10_000, fetch_retry_backoff_scalar: 1.5, fetch_retry_timeout_millis: 10_000) ⇒ RemoteEvaluationConfig

Returns a new instance of RemoteEvaluationConfig.

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.

  • fetch_timeout_millis (Integer) (defaults to: 10_000)

    The request timeout, in milliseconds, used when fetching variants triggered by calling start() or setUser().

  • fetch_retries (Integer) (defaults to: 0)

    The number of retries to attempt before failing.

  • fetch_retry_backoff_min_millis (Integer) (defaults to: 500)

    Retry backoff minimum (starting backoff delay) in milliseconds. The minimum backoff is scaled by ‘fetch_retry_backoff_scalar` after each retry failure.

  • fetch_retry_backoff_max_millis (Integer) (defaults to: 10_000)

    Retry backoff maximum in milliseconds. If the scaled backoff is greater than the max, the max is used for all subsequent retries.

  • fetch_retry_backoff_scalar (Float) (defaults to: 1.5)

    Scales the minimum backoff exponentially.

  • fetch_retry_timeout_millis (Integer) (defaults to: 10_000)

    The request timeout for retrying fetch requests.



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/experiment/remote/config.rb', line 52

def initialize(debug: false, server_url: DEFAULT_SERVER_URL, fetch_timeout_millis: 10_000, fetch_retries: 0,
               fetch_retry_backoff_min_millis: 500, fetch_retry_backoff_max_millis: 10_000,
               fetch_retry_backoff_scalar: 1.5, fetch_retry_timeout_millis: 10_000)
  @debug = debug
  @server_url = server_url
  @fetch_timeout_millis = fetch_timeout_millis
  @fetch_retries = fetch_retries
  @fetch_retry_backoff_min_millis = fetch_retry_backoff_min_millis
  @fetch_retry_backoff_max_millis = fetch_retry_backoff_max_millis
  @fetch_retry_backoff_scalar = fetch_retry_backoff_scalar
  @fetch_retry_timeout_millis = fetch_retry_timeout_millis
end

Instance Attribute Details

#debugBoolean

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

Returns:

  • (Boolean)

    the value of debug



9
10
11
# File 'lib/experiment/remote/config.rb', line 9

def debug
  @debug
end

#fetch_retriesInteger

The number of retries to attempt before failing.

Returns:

  • (Integer)

    the value of fetch_retries



21
22
23
# File 'lib/experiment/remote/config.rb', line 21

def fetch_retries
  @fetch_retries
end

#fetch_retry_backoff_max_millisInteger

Retry backoff maximum in milliseconds. If the scaled backoff is greater than the max,

the max is used for all subsequent retries.

Returns:

  • (Integer)

    the value of fetch_retry_backoff_max_millis



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

def fetch_retry_backoff_max_millis
  @fetch_retry_backoff_max_millis
end

#fetch_retry_backoff_min_millisInteger

Retry backoff minimum (starting backoff delay) in milliseconds. The minimum backoff is scaled

by `fetch_retry_backoff_scalar` after each retry failure.

Returns:

  • (Integer)

    the value of fetch_retry_backoff_min_millis



26
27
28
# File 'lib/experiment/remote/config.rb', line 26

def fetch_retry_backoff_min_millis
  @fetch_retry_backoff_min_millis
end

#fetch_retry_backoff_scalarFloat

Scales the minimum backoff exponentially.

Returns:

  • (Float)

    the value of fetch_retry_backoff_scalar



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

def fetch_retry_backoff_scalar
  @fetch_retry_backoff_scalar
end

#fetch_retry_timeout_millisInteger

The request timeout for retrying fetch requests.

Returns:

  • (Integer)

    the value of fetch_retry_timeout_millis



39
40
41
# File 'lib/experiment/remote/config.rb', line 39

def fetch_retry_timeout_millis
  @fetch_retry_timeout_millis
end

#fetch_timeout_millisInteger

The request timeout, in milliseconds, used when fetching variants triggered by calling start() or setUser().

Returns:

  • (Integer)

    the value of fetch_timeout_millis



17
18
19
# File 'lib/experiment/remote/config.rb', line 17

def fetch_timeout_millis
  @fetch_timeout_millis
end

#server_urlBoolean

The server endpoint from which to request variants.

Returns:

  • (Boolean)

    the value of server url



13
14
15
# File 'lib/experiment/remote/config.rb', line 13

def server_url
  @server_url
end