From 3a9da919f75644d2a5dc216a73ac4fdc7dac6e4c Mon Sep 17 00:00:00 2001 From: Tim Yiu <137842098+tyiuhc@users.noreply.github.com> Date: Mon, 10 Nov 2025 14:01:42 -0800 Subject: [PATCH 1/2] fix: add serverZone config to remote evaluation client --- src/amplitude_experiment/local/config.py | 4 ++-- src/amplitude_experiment/remote/config.py | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/amplitude_experiment/local/config.py b/src/amplitude_experiment/local/config.py index 2331f97..7883783 100644 --- a/src/amplitude_experiment/local/config.py +++ b/src/amplitude_experiment/local/config.py @@ -4,7 +4,7 @@ from ..cohort.cohort_sync_config import CohortSyncConfig, DEFAULT_COHORT_SYNC_URL, EU_COHORT_SYNC_URL DEFAULT_SERVER_URL = 'https://api.lab.amplitude.com' -EU_SERVER_URL = 'https://flag.lab.eu.amplitude.com' +EU_FLAG_SERVER_URL = 'https://flag.lab.eu.amplitude.com' DEFAULT_STREAM_URL = 'https://stream.lab.amplitude.com' EU_STREAM_SERVER_URL = 'https://stream.lab.eu.amplitude.com' @@ -49,7 +49,7 @@ def __init__(self, debug: bool = False, self.server_zone = server_zone self.cohort_sync_config = cohort_sync_config if server_url == DEFAULT_SERVER_URL and server_zone == ServerZone.EU: - self.server_url = EU_SERVER_URL + self.server_url = EU_FLAG_SERVER_URL if (cohort_sync_config is not None and cohort_sync_config.cohort_server_url == DEFAULT_COHORT_SYNC_URL): self.cohort_sync_config.cohort_server_url = EU_COHORT_SYNC_URL diff --git a/src/amplitude_experiment/remote/config.py b/src/amplitude_experiment/remote/config.py index 7e84bf5..d8f18c3 100644 --- a/src/amplitude_experiment/remote/config.py +++ b/src/amplitude_experiment/remote/config.py @@ -1,8 +1,9 @@ +DEFAULT_SERVER_URL = 'https://api.lab.amplitude.com' +EU_SERVER_URL = 'https://api.lab.eu.amplitude.com' + class RemoteEvaluationConfig: """Experiment Remote Client Configuration""" - DEFAULT_SERVER_URL = 'https://api.lab.amplitude.com' - def __init__(self, debug=False, server_url=DEFAULT_SERVER_URL, fetch_timeout_millis=10000, @@ -10,7 +11,8 @@ def __init__(self, debug=False, fetch_retry_backoff_min_millis=500, fetch_retry_backoff_max_millis=10000, fetch_retry_backoff_scalar=1.5, - fetch_retry_timeout_millis=10000): + fetch_retry_timeout_millis=10000, + server_zone='us'): """ Initialize a config Parameters: @@ -25,6 +27,7 @@ def __init__(self, debug=False, greater than the max, the max is used for all subsequent retries. fetch_retry_backoff_scalar (float): Scales the minimum backoff exponentially. fetch_retry_timeout_millis (int): The request timeout for retrying fetch requests. + server_zone (str): Select the Amplitude data center to get flags and variants from, `us` or `eu`. Returns: The config object @@ -37,3 +40,7 @@ def __init__(self, debug=False, self.fetch_retry_backoff_max_millis = fetch_retry_backoff_max_millis self.fetch_retry_backoff_scalar = fetch_retry_backoff_scalar self.fetch_retry_timeout_millis = fetch_retry_timeout_millis + self.server_zone = server_zone + if server_url == DEFAULT_SERVER_URL and server_zone == 'eu': + self.server_url = EU_SERVER_URL + From bc13e12738a1c0fd5646f32bc66ab37172ab5670 Mon Sep 17 00:00:00 2001 From: Tim Yiu <137842098+tyiuhc@users.noreply.github.com> Date: Mon, 10 Nov 2025 14:23:04 -0800 Subject: [PATCH 2/2] revert --- src/amplitude_experiment/local/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amplitude_experiment/local/config.py b/src/amplitude_experiment/local/config.py index 7883783..2331f97 100644 --- a/src/amplitude_experiment/local/config.py +++ b/src/amplitude_experiment/local/config.py @@ -4,7 +4,7 @@ from ..cohort.cohort_sync_config import CohortSyncConfig, DEFAULT_COHORT_SYNC_URL, EU_COHORT_SYNC_URL DEFAULT_SERVER_URL = 'https://api.lab.amplitude.com' -EU_FLAG_SERVER_URL = 'https://flag.lab.eu.amplitude.com' +EU_SERVER_URL = 'https://flag.lab.eu.amplitude.com' DEFAULT_STREAM_URL = 'https://stream.lab.amplitude.com' EU_STREAM_SERVER_URL = 'https://stream.lab.eu.amplitude.com' @@ -49,7 +49,7 @@ def __init__(self, debug: bool = False, self.server_zone = server_zone self.cohort_sync_config = cohort_sync_config if server_url == DEFAULT_SERVER_URL and server_zone == ServerZone.EU: - self.server_url = EU_FLAG_SERVER_URL + self.server_url = EU_SERVER_URL if (cohort_sync_config is not None and cohort_sync_config.cohort_server_url == DEFAULT_COHORT_SYNC_URL): self.cohort_sync_config.cohort_server_url = EU_COHORT_SYNC_URL