Skip to content

Commit ed1a8f2

Browse files
authored
Merge pull request #344 from splitio/dw-client-log-func-comments
Dw client log func comments
2 parents 842d5e1 + 75d1550 commit ed1a8f2

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

doc/source/introduction.rst

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The following snippet shows you how to create a basic client using the default c
2626
>>> from splitio import get_factory
2727
>>> factory = get_factory('some_api_key')
2828
>>> client = factory.client()
29-
>>> client.get_treatment('some_user', 'some_feature_flag')
29+
>>> client.get_treatment('some_user', 'some_feature')
3030
'SOME_TREATMENT'
3131

3232
Bucketing key
@@ -39,11 +39,11 @@ In advanced mode the key can be set as two different parts, one of them just to
3939
>>> split_key = Key(user, bucketing_key)
4040
>>> factory = get_factory('API_KEY')
4141
>>> client = factory.client()
42-
>>> client.get_treatment(split_key, 'some_feature_flag')
42+
>>> client.get_treatment(split_key, 'some_feature')
4343

4444
Manager API
4545
-----------
46-
Manager API is very useful to get a representation (view) of cached feature flags: ::
46+
Manager API is very useful to get a representation (view) of cached splits: ::
4747

4848
>>> from splitio import get_factory
4949
>>> factory = get_factory('API_KEY')
@@ -57,7 +57,7 @@ Available methods:
5757
**split(name):** Returns a SplitView instance ::
5858
>>> manager.split('some_test_name')
5959

60-
**split_names():** Returns a list of Feature Flag names (String) ::
60+
**split_names():** Returns a list of Split names (String) ::
6161
>>> manager.split_names()
6262

6363
Client configuration
@@ -79,7 +79,7 @@ All the possible configuration options are:
7979
+------------------------+------+--------------------------------------------------------+---------+
8080
| readTimeout | int | The read timeout for HTTP connections in milliseconds. | 1500 |
8181
+------------------------+------+--------------------------------------------------------+---------+
82-
| featuresRefreshRate | int | The feature flags update refresh period in | 5 |
82+
| featuresRefreshRate | int | The features (splits) update refresh period in | 5 |
8383
| | | seconds. | |
8484
+------------------------+------+--------------------------------------------------------+---------+
8585
| segmentsRefreshRate | int | The segments update refresh period in seconds. | 60 |
@@ -88,10 +88,10 @@ All the possible configuration options are:
8888
+------------------------+------+--------------------------------------------------------+---------+
8989
| impressionsRefreshRate | int | The impressions report period in seconds | 60 |
9090
+------------------------+------+--------------------------------------------------------+---------+
91-
| ready | int | How long to wait (in milliseconds) for the feature | |
92-
| | | flags and segments information to be available. If | |
93-
| | | the timeout is exceeded, a ``TimeoutException`` will | |
94-
| | | be raised. If value is 0, the constructor will return | |
91+
| ready | int | How long to wait (in milliseconds) for the features | |
92+
| | | and segments information to be available. If the | |
93+
| | | timeout is exceeded, a ``TimeoutException`` will be | |
94+
| | | raised. If value is 0, the constructor will return | |
9595
| | | immediately but not all the information might be | |
9696
| | | available right away. | |
9797
+------------------------+------+--------------------------------------------------------+---------+
@@ -106,31 +106,31 @@ directory. The ``.split`` file has the following format: ::
106106

107107
file: (comment | split_line)+
108108
comment : '#' string*\n
109-
split_line : feature_flag_name ' ' treatment\n
110-
feature_flag_name : string
109+
split_line : feature_name ' ' treatment\n
110+
feature_name : string
111111
treatment : string
112112

113113
This is an example of a ``.split`` file: ::
114114

115115
# This is a comment
116-
feature_flag_0 treatment_0
117-
feature_flag_1 treatment_1
116+
feature_0 treatment_0
117+
feature_1 treatment_1
118118

119-
Whenever a treatment is requested for the feature flag ``feature_flag_0``, ``treatment_0`` is going to be returned. The same goes for ``feature_flag_1`` and ``treatment_1``. The following example illustrates the behaviour: ::
119+
Whenever a treatment is requested for the feature ``feature_0``, ``treatment_0`` is going to be returned. The same goes for ``feature_1`` and ``treatment_1``. The following example illustrates the behaviour: ::
120120

121121
>>> from splitio import get_factory
122122
>>> factory = get_factory('localhost')
123123
>>> client = factory.client()
124-
>>> client.get_treatment('some_user', 'feature_flag_0')
124+
>>> client.get_treatment('some_user', 'feature_0')
125125
'treatment_0'
126-
>>> client.get_treatment('some_other_user', 'feature_flag_0')
126+
>>> client.get_treatment('some_other_user', 'feature_0')
127127
'treatment_0'
128-
>>> client.get_treatment('yet_another_user', 'feature_flag_1')
128+
>>> client.get_treatment('yet_another_user', 'feature_1')
129129
'treatment_1'
130-
>>> client.get_treatment('some_user', 'non_existent_feature_flag')
130+
>>> client.get_treatment('some_user', 'non_existent_feature')
131131
'CONTROL'
132132

133-
Notice that an API key is not necessary for the localhost environment, and the ``CONTROL`` is returned for non existent feature flags.
133+
Notice that an API key is not necessary for the localhost environment, and the ``CONTROL`` is returned for non existent features.
134134

135135
It is possible to specify a different splits file using the ``split_definition_file_name`` argument: ::
136136

@@ -161,7 +161,7 @@ Before you can use it, you need to install the ``splitio_client`` with support f
161161

162162
pip install splitio_client[redis]
163163

164-
The client depends on the information for feature flags and segments being updated externally. In order to do that, we provide the ``update_splits`` and ``update_segments`` scripts or even the ``splitio.bin.synchronizer`` service.
164+
The client depends on the information for features and segments being updated externally. In order to do that, we provide the ``update_splits`` and ``update_segments`` scripts or even the ``splitio.bin.synchronizer`` service.
165165

166166
The scripts are configured through a JSON settings file, like the following: ::
167167

@@ -198,7 +198,7 @@ These are the possible configuration parameters:
198198
| redisDb | int | The db number on the Redis instance | 0 |
199199
+------------------------+------+--------------------------------------------------------+-------------------------------+
200200

201-
Let's assume that the configuration file is called ``splitio-config.json`` and that the client is installed in a virtualenv in ``/home/user/venv``. The feature flag update script can be run with: ::
201+
Let's assume that the configuration file is called ``splitio-config.json`` and that the client is installed in a virtualenv in ``/home/user/venv``. The feature update script can be run with: ::
202202

203203
$ /home/user/venv/bin/python -m splitio.update_scripts.update_splits splitio-config.json
204204

splitio/client/client.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def _make_evaluation(self, key, feature, attributes, method_name, metric_name):
116116
self._record_stats([(impression, attributes)], start, metric_name, method_name)
117117
return result['treatment'], result['configurations']
118118
except Exception as e: # pylint: disable=broad-except
119-
_LOGGER.error('Error getting treatment for feature')
119+
_LOGGER.error('Error getting treatment for feature flag')
120120
_LOGGER.error(str(e))
121121
_LOGGER.debug('Error: ', exc_info=True)
122122
self._telemetry_evaluation_producer.record_exception(metric_name)
@@ -185,7 +185,7 @@ def _make_evaluations(self, key, features, attributes, method_name, metric_name)
185185

186186
except Exception: # pylint: disable=broad-except
187187
_LOGGER.error('%s: An exception occured when evaluating '
188-
'feature %s returning CONTROL.' % (method_name, feature))
188+
'feature flag %s returning CONTROL.' % (method_name, feature))
189189
treatments[feature] = CONTROL, None
190190
_LOGGER.debug('Error: ', exc_info=True)
191191
continue
@@ -208,7 +208,7 @@ def _make_evaluations(self, key, features, attributes, method_name, metric_name)
208208
return treatments
209209
except Exception: # pylint: disable=broad-except
210210
self._telemetry_evaluation_producer.record_exception(metric_name)
211-
_LOGGER.error('Error getting treatment for features')
211+
_LOGGER.error('Error getting treatment for feature flags')
212212
_LOGGER.debug('Error: ', exc_info=True)
213213
return input_validator.generate_control_treatments(list(features), method_name)
214214

@@ -233,37 +233,37 @@ def _evaluate_features_if_ready(self, matching_key, bucketing_key, features, att
233233

234234
def get_treatment_with_config(self, key, feature, attributes=None):
235235
"""
236-
Get the treatment and config for a feature and key, with optional dictionary of attributes.
236+
Get the treatment and config for a feature flag and key, with optional dictionary of attributes.
237237
238238
This method never raises an exception. If there's a problem, the appropriate log message
239239
will be generated and the method will return the CONTROL treatment.
240240
241241
:param key: The key for which to get the treatment
242242
:type key: str
243-
:param feature: The name of the feature for which to get the treatment
243+
:param feature: The name of the feature flag for which to get the treatment
244244
:type feature: str
245245
:param attributes: An optional dictionary of attributes
246246
:type attributes: dict
247-
:return: The treatment for the key and feature
247+
:return: The treatment for the key and feature flag
248248
:rtype: tuple(str, str)
249249
"""
250250
return self._make_evaluation(key, feature, attributes, 'get_treatment_with_config',
251251
MethodExceptionsAndLatencies.TREATMENT_WITH_CONFIG)
252252

253253
def get_treatment(self, key, feature, attributes=None):
254254
"""
255-
Get the treatment for a feature and key, with an optional dictionary of attributes.
255+
Get the treatment for a feature flag and key, with an optional dictionary of attributes.
256256
257257
This method never raises an exception. If there's a problem, the appropriate log message
258258
will be generated and the method will return the CONTROL treatment.
259259
260260
:param key: The key for which to get the treatment
261261
:type key: str
262-
:param feature: The name of the feature for which to get the treatment
262+
:param feature: The name of the feature flag for which to get the treatment
263263
:type feature: str
264264
:param attributes: An optional dictionary of attributes
265265
:type attributes: dict
266-
:return: The treatment for the key and feature
266+
:return: The treatment for the key and feature flag
267267
:rtype: str
268268
"""
269269
treatment, _ = self._make_evaluation(key, feature, attributes, 'get_treatment',
@@ -272,37 +272,37 @@ def get_treatment(self, key, feature, attributes=None):
272272

273273
def get_treatments_with_config(self, key, features, attributes=None):
274274
"""
275-
Evaluate multiple features and return a dict with feature -> (treatment, config).
275+
Evaluate multiple feature flags and return a dict with feature flag -> (treatment, config).
276276
277-
Get the treatments for a list of features considering a key, with an optional dictionary of
277+
Get the treatments for a list of feature flags considering a key, with an optional dictionary of
278278
attributes. This method never raises an exception. If there's a problem, the appropriate
279279
log message will be generated and the method will return the CONTROL treatment.
280280
:param key: The key for which to get the treatment
281281
:type key: str
282-
:param features: Array of the names of the features for which to get the treatment
282+
:param features: Array of the names of the feature flags for which to get the treatment
283283
:type feature: list
284284
:param attributes: An optional dictionary of attributes
285285
:type attributes: dict
286-
:return: Dictionary with the result of all the features provided
286+
:return: Dictionary with the result of all the feature flags provided
287287
:rtype: dict
288288
"""
289289
return self._make_evaluations(key, features, attributes, 'get_treatments_with_config',
290290
MethodExceptionsAndLatencies.TREATMENTS_WITH_CONFIG)
291291

292292
def get_treatments(self, key, features, attributes=None):
293293
"""
294-
Evaluate multiple features and return a dictionary with all the feature/treatments.
294+
Evaluate multiple feature flags and return a dictionary with all the feature flag/treatments.
295295
296-
Get the treatments for a list of features considering a key, with an optional dictionary of
296+
Get the treatments for a list of feature flags considering a key, with an optional dictionary of
297297
attributes. This method never raises an exception. If there's a problem, the appropriate
298298
log message will be generated and the method will return the CONTROL treatment.
299299
:param key: The key for which to get the treatment
300300
:type key: str
301-
:param features: Array of the names of the features for which to get the treatment
301+
:param features: Array of the names of the feature flags for which to get the treatment
302302
:type feature: list
303303
:param attributes: An optional dictionary of attributes
304304
:type attributes: dict
305-
:return: Dictionary with the result of all the features provided
305+
:return: Dictionary with the result of all the feature flags provided
306306
:rtype: dict
307307
"""
308308
with_config = self._make_evaluations(key, features, attributes, 'get_treatments',

0 commit comments

Comments
 (0)