From e6119de090cb343d6f0819ce144977a29d249294 Mon Sep 17 00:00:00 2001 From: Bilal Al-Shahwany Date: Wed, 1 Nov 2023 12:03:28 -0700 Subject: [PATCH 1/2] 1- Added flagset filter check with consumer mode 2- Updated changes.txt 3- Removed exception when telemetry post config fails --- CHANGES.txt | 10 ++++++++++ splitio/api/telemetry.py | 1 - splitio/client/config.py | 6 +++++- tests/client/test_config.py | 12 ++++++++---- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 6ea03dfc..1a128006 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,13 @@ +9.6.1 (Nov 3, 2023) +- Added support for Flag Sets on the SDK, which enables grouping feature flags and interacting with the group rather than individually (more details in our documentation): + - Added new variations of the get treatment methods to support evaluating flags in given flag set/s. + - getTreatmentsByFlagSet and getTreatmentsByFlagSets + - getTreatmentWithConfigByFlagSets and getTreatmentsWithConfigByFlagSets +- Added a new optional Split Filter configuration option. This allows the SDK and Split services to only synchronize the flags in the specified flag sets, avoiding unused or unwanted flags from being synced on the SDK instance, bringing all the benefits from a reduced payload. + - Note: Only applicable when the SDK is in charge of the rollout data synchronization. When not applicable, the SDK will log a warning on init. +- Updated the following SDK manager methods to expose flag sets on flag views. +- Removed raising an exception when Telemetry post config data fails, SDK will only log the error. + 9.5.1 (Sep 5, 2023) - Exclude tests from when building the package - Fixed exception when fetching telemetry stats if no SSE Feature flags update events are stored diff --git a/splitio/api/telemetry.py b/splitio/api/telemetry.py index 4c182a4e..722bb75d 100644 --- a/splitio/api/telemetry.py +++ b/splitio/api/telemetry.py @@ -76,7 +76,6 @@ def record_init(self, configs): 'Error posting init config because an exception was raised by the HTTPClient' ) _LOGGER.debug('Error: ', exc_info=True) - raise APIException('Init config data not flushed properly.') from exc def record_stats(self, stats): """ diff --git a/splitio/client/config.py b/splitio/client/config.py index 429861b8..437df62e 100644 --- a/splitio/client/config.py +++ b/splitio/client/config.py @@ -143,6 +143,10 @@ def sanitize(sdk_key, config): _LOGGER.warning('metricRefreshRate parameter minimum value is 60 seconds, defaulting to 3600 seconds.') processed['metricsRefreshRate'] = 3600 - processed['flagSetsFilter'] = sorted(validate_flag_sets(processed['flagSetsFilter'], 'SDK Config')) if processed['flagSetsFilter'] is not None else None + if config['operationMode'] == 'consumer' and config.get('flagSetsFilter') is not None: + processed['flagSetsFilter'] = None + _LOGGER.warning('config: FlagSets filter is not applicable for Consumer modes where the SDK does keep rollout data in sync. FlagSet filter was discarded.') + else: + processed['flagSetsFilter'] = sorted(validate_flag_sets(processed['flagSetsFilter'], 'SDK Config')) if processed['flagSetsFilter'] is not None else None return processed diff --git a/tests/client/test_config.py b/tests/client/test_config.py index ebd10c71..b4b9d9e9 100644 --- a/tests/client/test_config.py +++ b/tests/client/test_config.py @@ -65,8 +65,12 @@ def test_sanitize_imp_mode(self): def test_sanitize(self): """Test sanitization.""" - configs = {} - processed = config.sanitize('some', configs) - + processed = config.sanitize('some', {}) assert processed['redisLocalCacheEnabled'] # check default is True - assert processed['flagSetsFilter'] is None \ No newline at end of file + assert processed['flagSetsFilter'] is None + + processed = config.sanitize('some', {'redisHost': 'x', 'flagSetsFilter': ['set']}) + assert processed['flagSetsFilter'] is None + + processed = config.sanitize('some', {'storageType': 'pluggable', 'flagSetsFilter': ['set']}) + assert processed['flagSetsFilter'] is None From 55f39a051d7614625fd159be08d5faef899bd961 Mon Sep 17 00:00:00 2001 From: Bilal Al-Shahwany Date: Wed, 1 Nov 2023 13:15:03 -0700 Subject: [PATCH 2/2] cleanup --- CHANGES.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 1a128006..5e464588 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,8 +1,8 @@ 9.6.1 (Nov 3, 2023) - Added support for Flag Sets on the SDK, which enables grouping feature flags and interacting with the group rather than individually (more details in our documentation): - Added new variations of the get treatment methods to support evaluating flags in given flag set/s. - - getTreatmentsByFlagSet and getTreatmentsByFlagSets - - getTreatmentWithConfigByFlagSets and getTreatmentsWithConfigByFlagSets + - get_treatments_by_flag_set and get_treatments_by_flag_sets + - get_treatments_with_config_by_flag_set and get_treatments_with_config_by_flag_sets - Added a new optional Split Filter configuration option. This allows the SDK and Split services to only synchronize the flags in the specified flag sets, avoiding unused or unwanted flags from being synced on the SDK instance, bringing all the benefits from a reduced payload. - Note: Only applicable when the SDK is in charge of the rollout data synchronization. When not applicable, the SDK will log a warning on init. - Updated the following SDK manager methods to expose flag sets on flag views.