Skip to content

Commit c85ce86

Browse files
authored
Merge pull request #373 from splitio/development
Release 9.4.2
2 parents 4e2b33a + bdb54f8 commit c85ce86

30 files changed

+425
-385
lines changed

CHANGES.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
9.4.2 (May 15, 2023)
2+
- Updated terminology on the SDKs codebase to be more aligned with current standard without causing a breaking change. The core change is the term split for feature flag on things like logs and code documentation comments.
3+
- Added detailed debug logging for redis adapter.
4+
- Fixed setting defaultTreatment to 'control' if it is missing in localhost JSON file.
5+
16
9.4.1 (Apr 18, 2023)
27
- Fixed storing incorrect Telemetry method latency data
38

@@ -103,7 +108,7 @@
103108
7.0.1 (Mar 8, 2019)
104109
- Updated Splits refreshing rate.
105110
- Replaced exception log level to error level.
106-
- Improved validation for apikey.
111+
- Improved validation for sdkkey.
107112

108113
7.0.0 (Feb 21, 2019)
109114
- BREAKING CHANGE: Stored Impressions in Queue.

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ factory = get_factory('YOUR_SDK_TYPE_API_KEY', config=config)
2222
try:
2323
factory.block_until_ready(5) # wait up to 5 seconds
2424
split = factory.client()
25-
treatment = split.get_treatment('CUSTOMER_ID', 'SPLIT_NAME')
25+
treatment = split.get_treatment('CUSTOMER_ID', 'FEATURE_FLAG_NAME')
2626
if treatment == "on":
2727
# insert code here to show on treatment
2828
elif treatment == "off":
@@ -54,16 +54,21 @@ To learn more about Split, contact hello@split.io, or get started with feature f
5454

5555
Split has built and maintains SDKs for:
5656

57+
* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
58+
* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
59+
* Angular [Github](https://github.com/splitio/angular-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/6495326064397-Angular-utilities)
60+
* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
61+
* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
5762
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
58-
* Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
63+
* JavaScript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
64+
* JavaScript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
5965
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
60-
* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
61-
* Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)
6266
* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
6367
* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)
64-
* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
65-
* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
66-
* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
68+
* React [Github](https://github.com/splitio/react-client) [Docs](https://help.split.io/hc/en-us/articles/360038825091-React-SDK)
69+
* React Native [Github](https://github.com/splitio/react-native-client) [Docs](https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK)
70+
* Redux [Github](https://github.com/splitio/redux-client) [Docs](https://help.split.io/hc/en-us/articles/360038851551-Redux-SDK)
71+
* Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)
6772

6873
For a comprehensive list of open source projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20).
6974

doc/source/introduction.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ The client depends on the information for features and segments being updated ex
166166
The scripts are configured through a JSON settings file, like the following: ::
167167

168168
{
169-
"apiKey": "some-api-key",
169+
"sdkKey": "some-sdk-key",
170170
"sdkApiBaseUrl": "https://sdk.split.io/api",
171171
"eventsApiBaseUrl": "https://events.split.io/api",
172172
"redisFactory": 'some.redis.factory',
@@ -180,7 +180,7 @@ These are the possible configuration parameters:
180180
+------------------------+------+--------------------------------------------------------+-------------------------------+
181181
| Key | Type | Description | Default |
182182
+========================+======+========================================================+===============================+
183-
| apiKey | str | A valid Split.io API key. | None |
183+
| sdkKey | str | A valid Split.io SDK key. | None |
184184
+------------------------+------+--------------------------------------------------------+-------------------------------+
185185
| sdkApiBaseUrl | str | The SDK API url base | "https://sdk.split.io/api" |
186186
+------------------------+------+--------------------------------------------------------+-------------------------------+
@@ -238,7 +238,7 @@ On the other hand, there is available a python script named ``splitio.bin.synchr
238238
The configuration file is a JSON file with the following fields:
239239

240240
{
241-
"apiKey": "YOUR_API_KEY",
241+
"sdkKey": "YOUR_SDK_KEY",
242242
"redisHost": "REDIS_DNS_OR_IP",
243243
"redisPort": 6379,
244244
"redisDb": 0
@@ -274,7 +274,7 @@ In order to support Redis' Sentinel host discovery, you need to provide a custom
274274
Afterwards you tell the client to use this factory using the config file: ::
275275

276276
{
277-
"apiKey": "some-api-key",
277+
"sdkKey": "some-sdk-key",
278278
"sdkApiBaseUrl": "https://sdk.split.io/api",
279279
"eventsApiBaseUrl": "https://events.split.io/api",
280280
"redisFactory": 'redis_config.my_redis_factory'

splitio/api/auth.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
class AuthAPI(object): # pylint: disable=too-few-public-methods
1717
"""Class that uses an httpClient to communicate with the SDK Auth Service API."""
1818

19-
def __init__(self, client, apikey, sdk_metadata, telemetry_runtime_producer):
19+
def __init__(self, client, sdk_key, sdk_metadata, telemetry_runtime_producer):
2020
"""
2121
Class constructor.
2222
2323
:param client: HTTP Client responsble for issuing calls to the backend.
2424
:type client: HttpClient
25-
:param apikey: User apikey token.
26-
:type apikey: string
25+
:param sdk_key: User sdk key.
26+
:type sdk_key: string
2727
:param sdk_metadata: SDK version & machine name & IP.
2828
:type sdk_metadata: splitio.client.util.SdkMetadata
2929
"""
3030
self._client = client
31-
self._apikey = apikey
31+
self._sdk_key = sdk_key
3232
self._metadata = headers_from_metadata(sdk_metadata)
3333
self._telemetry_runtime_producer = telemetry_runtime_producer
3434

@@ -44,7 +44,7 @@ def authenticate(self):
4444
response = self._client.get(
4545
'auth',
4646
'/v2/auth',
47-
self._apikey,
47+
self._sdk_key,
4848
extra_headers=self._metadata,
4949
)
5050
record_telemetry(response.status_code, get_current_epoch_time_ms() - start, HTTPExceptionsAndLatencies.TOKEN, self._telemetry_runtime_producer)

splitio/api/client.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,28 +66,28 @@ def _build_url(self, server, path):
6666
return self._urls[server] + path
6767

6868
@staticmethod
69-
def _build_basic_headers(apikey):
69+
def _build_basic_headers(sdk_key):
7070
"""
7171
Build basic headers with auth.
7272
73-
:param apikey: API token used to identify backend calls.
74-
:type apikey: str
73+
:param sdk_key: API token used to identify backend calls.
74+
:type sdk_key: str
7575
"""
7676
return {
7777
'Content-Type': 'application/json',
78-
'Authorization': "Bearer %s" % apikey
78+
'Authorization': "Bearer %s" % sdk_key
7979
}
8080

81-
def get(self, server, path, apikey, query=None, extra_headers=None): # pylint: disable=too-many-arguments
81+
def get(self, server, path, sdk_key, query=None, extra_headers=None): # pylint: disable=too-many-arguments
8282
"""
8383
Issue a get request.
8484
8585
:param server: Whether the request is for SDK server, Events server or Auth server.
8686
:typee server: str
8787
:param path: path to append to the host url.
8888
:type path: str
89-
:param apikey: api token.
90-
:type apikey: str
89+
:param sdk_key: sdk key.
90+
:type sdk_key: str
9191
:param query: Query string passed as dictionary.
9292
:type query: dict
9393
:param extra_headers: key/value pairs of possible extra headers.
@@ -96,7 +96,7 @@ def get(self, server, path, apikey, query=None, extra_headers=None): # pylint:
9696
:return: Tuple of status_code & response text
9797
:rtype: HttpResponse
9898
"""
99-
headers = self._build_basic_headers(apikey)
99+
headers = self._build_basic_headers(sdk_key)
100100
if extra_headers is not None:
101101
headers.update(extra_headers)
102102

@@ -111,16 +111,16 @@ def get(self, server, path, apikey, query=None, extra_headers=None): # pylint:
111111
except Exception as exc: # pylint: disable=broad-except
112112
raise HttpClientException('requests library is throwing exceptions') from exc
113113

114-
def post(self, server, path, apikey, body, query=None, extra_headers=None): # pylint: disable=too-many-arguments
114+
def post(self, server, path, sdk_key, body, query=None, extra_headers=None): # pylint: disable=too-many-arguments
115115
"""
116116
Issue a POST request.
117117
118118
:param server: Whether the request is for SDK server or Events server.
119119
:typee server: str
120120
:param path: path to append to the host url.
121121
:type path: str
122-
:param apikey: api token.
123-
:type apikey: str
122+
:param sdk_key: sdk key.
123+
:type sdk_key: str
124124
:param body: body sent in the request.
125125
:type body: str
126126
:param query: Query string passed as dictionary.
@@ -131,7 +131,7 @@ def post(self, server, path, apikey, body, query=None, extra_headers=None): # p
131131
:return: Tuple of status_code & response text
132132
:rtype: HttpResponse
133133
"""
134-
headers = self._build_basic_headers(apikey)
134+
headers = self._build_basic_headers(sdk_key)
135135

136136
if extra_headers is not None:
137137
headers.update(extra_headers)

splitio/api/events.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@
1515
class EventsAPI(object): # pylint: disable=too-few-public-methods
1616
"""Class that uses an httpClient to communicate with the events API."""
1717

18-
def __init__(self, http_client, apikey, sdk_metadata, telemetry_runtime_producer):
18+
def __init__(self, http_client, sdk_key, sdk_metadata, telemetry_runtime_producer):
1919
"""
2020
Class constructor.
2121
2222
:param http_client: HTTP Client responsble for issuing calls to the backend.
2323
:type http_client: HttpClient
24-
:param apikey: User apikey token.
25-
:type apikey: string
24+
:param sdk_key: sdk key.
25+
:type sdk_key: string
2626
:param sdk_metadata: SDK version & machine name & IP.
2727
:type sdk_metadata: splitio.client.util.SdkMetadata
2828
"""
2929
self._client = http_client
30-
self._apikey = apikey
30+
self._sdk_key = sdk_key
3131
self._metadata = headers_from_metadata(sdk_metadata)
3232
self._telemetry_runtime_producer = telemetry_runtime_producer
3333

@@ -70,7 +70,7 @@ def flush_events(self, events):
7070
response = self._client.post(
7171
'events',
7272
'/events/bulk',
73-
self._apikey,
73+
self._sdk_key,
7474
body=bulk,
7575
extra_headers=self._metadata,
7676
)

splitio/api/impressions.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
class ImpressionsAPI(object): # pylint: disable=too-few-public-methods
1818
"""Class that uses an httpClient to communicate with the impressions API."""
1919

20-
def __init__(self, client, apikey, sdk_metadata, telemetry_runtime_producer, mode=ImpressionsMode.OPTIMIZED):
20+
def __init__(self, client, sdk_key, sdk_metadata, telemetry_runtime_producer, mode=ImpressionsMode.OPTIMIZED):
2121
"""
2222
Class constructor.
2323
2424
:param client: HTTP Client responsble for issuing calls to the backend.
2525
:type client: HttpClient
26-
:param apikey: User apikey token.
27-
:type apikey: string
26+
:param sdk_key: sdk key.
27+
:type sdk_key: string
2828
"""
2929
self._client = client
30-
self._apikey = apikey
30+
self._sdk_key = sdk_key
3131
self._metadata = headers_from_metadata(sdk_metadata)
3232
self._metadata['SplitSDKImpressionsMode'] = mode.name
3333
self._telemetry_runtime_producer = telemetry_runtime_producer
@@ -99,7 +99,7 @@ def flush_impressions(self, impressions):
9999
response = self._client.post(
100100
'events',
101101
'/testImpressions/bulk',
102-
self._apikey,
102+
self._sdk_key,
103103
body=bulk,
104104
extra_headers=self._metadata,
105105
)
@@ -126,7 +126,7 @@ def flush_counters(self, counters):
126126
response = self._client.post(
127127
'events',
128128
'/testImpressions/count',
129-
self._apikey,
129+
self._sdk_key,
130130
body=bulk,
131131
extra_headers=self._metadata,
132132
)

splitio/api/segments.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@
1717
class SegmentsAPI(object): # pylint: disable=too-few-public-methods
1818
"""Class that uses an httpClient to communicate with the segments API."""
1919

20-
def __init__(self, http_client, apikey, sdk_metadata, telemetry_runtime_producer):
20+
def __init__(self, http_client, sdk_key, sdk_metadata, telemetry_runtime_producer):
2121
"""
2222
Class constructor.
2323
2424
:param client: HTTP Client responsble for issuing calls to the backend.
2525
:type client: client.HttpClient
26-
:param apikey: User apikey token.
27-
:type apikey: string
26+
:param sdk_key: User sdk_key token.
27+
:type sdk_key: string
2828
:param sdk_metadata: SDK version & machine name & IP.
2929
:type sdk_metadata: splitio.client.util.SdkMetadata
3030
3131
"""
3232
self._client = http_client
33-
self._apikey = apikey
33+
self._sdk_key = sdk_key
3434
self._metadata = headers_from_metadata(sdk_metadata)
3535
self._telemetry_runtime_producer = telemetry_runtime_producer
3636

@@ -56,7 +56,7 @@ def fetch_segment(self, segment_name, change_number, fetch_options):
5656
response = self._client.get(
5757
'sdk',
5858
'/segmentChanges/{segment_name}'.format(segment_name=segment_name),
59-
self._apikey,
59+
self._sdk_key,
6060
extra_headers=extra_headers,
6161
query=query,
6262
)

splitio/api/splits.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,30 @@
1616
class SplitsAPI(object): # pylint: disable=too-few-public-methods
1717
"""Class that uses an httpClient to communicate with the splits API."""
1818

19-
def __init__(self, client, apikey, sdk_metadata, telemetry_runtime_producer):
19+
def __init__(self, client, sdk_key, sdk_metadata, telemetry_runtime_producer):
2020
"""
2121
Class constructor.
2222
2323
:param client: HTTP Client responsble for issuing calls to the backend.
2424
:type client: HttpClient
25-
:param apikey: User apikey token.
26-
:type apikey: string
25+
:param sdk_key: User sdk_key token.
26+
:type sdk_key: string
2727
:param sdk_metadata: SDK version & machine name & IP.
2828
:type sdk_metadata: splitio.client.util.SdkMetadata
2929
"""
3030
self._client = client
31-
self._apikey = apikey
31+
self._sdk_key = sdk_key
3232
self._metadata = headers_from_metadata(sdk_metadata)
3333
self._telemetry_runtime_producer = telemetry_runtime_producer
3434

3535
def fetch_splits(self, change_number, fetch_options):
3636
"""
37-
Fetch splits from backend.
37+
Fetch feature flags from backend.
3838
3939
:param change_number: Last known timestamp of a split modification.
4040
:type change_number: int
4141
42-
:param fetch_options: Fetch options for getting split definitions.
42+
:param fetch_options: Fetch options for getting feature flag definitions.
4343
:type fetch_options: splitio.api.commons.FetchOptions
4444
4545
:return: Json representation of a splitChanges response.
@@ -51,7 +51,7 @@ def fetch_splits(self, change_number, fetch_options):
5151
response = self._client.get(
5252
'sdk',
5353
'/splitChanges',
54-
self._apikey,
54+
self._sdk_key,
5555
extra_headers=extra_headers,
5656
query=query,
5757
)
@@ -61,6 +61,6 @@ def fetch_splits(self, change_number, fetch_options):
6161
else:
6262
raise APIException(response.body, response.status_code)
6363
except HttpClientException as exc:
64-
_LOGGER.error('Error fetching splits because an exception was raised by the HTTPClient')
64+
_LOGGER.error('Error fetching feature flags because an exception was raised by the HTTPClient')
6565
_LOGGER.debug('Error: ', exc_info=True)
66-
raise APIException('Splits not fetched correctly.') from exc
66+
raise APIException('Feature flags not fetched correctly.') from exc

0 commit comments

Comments
 (0)