Skip to content

Commit 64d6d6d

Browse files
authored
fix: add server zone config to remote evaluation client (#66)
1 parent 3c5541b commit 64d6d6d

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/amplitude_experiment/remote/config.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1+
DEFAULT_SERVER_URL = 'https://api.lab.amplitude.com'
2+
EU_SERVER_URL = 'https://api.lab.eu.amplitude.com'
3+
14
class RemoteEvaluationConfig:
25
"""Experiment Remote Client Configuration"""
36

4-
DEFAULT_SERVER_URL = 'https://api.lab.amplitude.com'
5-
67
def __init__(self, debug=False,
78
server_url=DEFAULT_SERVER_URL,
89
fetch_timeout_millis=10000,
910
fetch_retries=0,
1011
fetch_retry_backoff_min_millis=500,
1112
fetch_retry_backoff_max_millis=10000,
1213
fetch_retry_backoff_scalar=1.5,
13-
fetch_retry_timeout_millis=10000):
14+
fetch_retry_timeout_millis=10000,
15+
server_zone='us'):
1416
"""
1517
Initialize a config
1618
Parameters:
@@ -25,6 +27,7 @@ def __init__(self, debug=False,
2527
greater than the max, the max is used for all subsequent retries.
2628
fetch_retry_backoff_scalar (float): Scales the minimum backoff exponentially.
2729
fetch_retry_timeout_millis (int): The request timeout for retrying fetch requests.
30+
server_zone (str): Select the Amplitude data center to get flags and variants from, `us` or `eu`.
2831
2932
Returns:
3033
The config object
@@ -37,3 +40,7 @@ def __init__(self, debug=False,
3740
self.fetch_retry_backoff_max_millis = fetch_retry_backoff_max_millis
3841
self.fetch_retry_backoff_scalar = fetch_retry_backoff_scalar
3942
self.fetch_retry_timeout_millis = fetch_retry_timeout_millis
43+
self.server_zone = server_zone
44+
if server_url == DEFAULT_SERVER_URL and server_zone == 'eu':
45+
self.server_url = EU_SERVER_URL
46+

0 commit comments

Comments
 (0)