Skip to content

Commit 3a9da91

Browse files
committed
fix: add serverZone config to remote evaluation client
1 parent 27b6669 commit 3a9da91

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/amplitude_experiment/local/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from ..cohort.cohort_sync_config import CohortSyncConfig, DEFAULT_COHORT_SYNC_URL, EU_COHORT_SYNC_URL
55

66
DEFAULT_SERVER_URL = 'https://api.lab.amplitude.com'
7-
EU_SERVER_URL = 'https://flag.lab.eu.amplitude.com'
7+
EU_FLAG_SERVER_URL = 'https://flag.lab.eu.amplitude.com'
88

99
DEFAULT_STREAM_URL = 'https://stream.lab.amplitude.com'
1010
EU_STREAM_SERVER_URL = 'https://stream.lab.eu.amplitude.com'
@@ -49,7 +49,7 @@ def __init__(self, debug: bool = False,
4949
self.server_zone = server_zone
5050
self.cohort_sync_config = cohort_sync_config
5151
if server_url == DEFAULT_SERVER_URL and server_zone == ServerZone.EU:
52-
self.server_url = EU_SERVER_URL
52+
self.server_url = EU_FLAG_SERVER_URL
5353
if (cohort_sync_config is not None and
5454
cohort_sync_config.cohort_server_url == DEFAULT_COHORT_SYNC_URL):
5555
self.cohort_sync_config.cohort_server_url = EU_COHORT_SYNC_URL

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)