Skip to content

Commit 5de6bc2

Browse files
committed
polishing
1 parent 14a7266 commit 5de6bc2

File tree

4 files changed

+8
-24
lines changed

4 files changed

+8
-24
lines changed

splitio/client/client.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@ def _get_treatment(self, method, key, feature, attributes=None):
292292
result = self._evaluator.eval_with_context(key, bucketing, feature, attributes, ctx)
293293
except Exception as e: # toto narrow this
294294
_LOGGER.error('Error getting treatment for feature flag')
295-
_LOGGER.error(str(e))
296295
_LOGGER.debug('Error: ', exc_info=True)
297296
self._telemetry_evaluation_producer.record_exception(method)
298297
result = self._FAILED_EVAL_RESULT
@@ -382,7 +381,6 @@ def _get_treatments(self, key, features, method, attributes=None):
382381
results = self._evaluator.eval_many_with_context(key, bucketing, features, attributes, ctx)
383382
except Exception as e: # toto narrow this
384383
_LOGGER.error('Error getting treatment for feature flag')
385-
_LOGGER.error(str(e))
386384
_LOGGER.debug('Error: ', exc_info=True)
387385
self._telemetry_evaluation_producer.record_exception(method)
388386
results = {n: self._FAILED_EVAL_RESULT for n in features}
@@ -572,7 +570,6 @@ async def _get_treatment(self, method, key, feature, attributes=None):
572570
result = self._evaluator.eval_with_context(key, bucketing, feature, attributes, ctx)
573571
except Exception as e: # toto narrow this
574572
_LOGGER.error('Error getting treatment for feature flag')
575-
_LOGGER.error(str(e))
576573
_LOGGER.debug('Error: ', exc_info=True)
577574
await self._telemetry_evaluation_producer.record_exception(method)
578575
result = self._FAILED_EVAL_RESULT
@@ -662,7 +659,6 @@ async def _get_treatments(self, key, features, method, attributes=None):
662659
results = self._evaluator.eval_many_with_context(key, bucketing, features, attributes, ctx)
663660
except Exception as e: # toto narrow this
664661
_LOGGER.error('Error getting treatment for feature flag')
665-
_LOGGER.error(str(e))
666662
_LOGGER.debug('Error: ', exc_info=True)
667663
await self._telemetry_evaluation_producer.record_exception(method)
668664
results = {n: self._FAILED_EVAL_RESULT for n in features}

splitio/client/factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ async def block_until_ready(self, timeout=None):
410410
await asyncio.wait_for(asyncio.shield(self._sdk_ready_flag.wait()), timeout)
411411
except asyncio.TimeoutError as e:
412412
_LOGGER.error("Exception initializing SDK")
413-
_LOGGER.error(str(e))
413+
_LOGGER.debug(str(e))
414414
await self._telemetry_init_producer.record_bur_time_out()
415415
raise TimeoutException('SDK Initialization: time of %d exceeded' % timeout)
416416

splitio/push/workers.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ class CompressionMode(Enum):
2323
GZIP_COMPRESSION = 1
2424
ZLIB_COMPRESSION = 2
2525

26+
_compression_handlers = {
27+
CompressionMode.NO_COMPRESSION: lambda event: base64.b64decode(event.feature_flag_definition),
28+
CompressionMode.GZIP_COMPRESSION: lambda event: gzip.decompress(base64.b64decode(event.feature_flag_definition)).decode('utf-8'),
29+
CompressionMode.ZLIB_COMPRESSION: lambda event: zlib.decompress(base64.b64decode(event.feature_flag_definition)).decode('utf-8'),
30+
}
31+
2632
class WorkerBase(object, metaclass=abc.ABCMeta):
2733
"""Worker template."""
2834

@@ -41,7 +47,7 @@ def stop(self):
4147
def _get_feature_flag_definition(self, event):
4248
"""return feature flag definition in event."""
4349
cm = CompressionMode(event.compression) # will throw if the number is not defined in compression mode
44-
return self._compression_handlers[cm](event)
50+
return _compression_handlers[cm](event)
4551

4652
class SegmentWorker(WorkerBase):
4753
"""Segment Worker for processing updates."""
@@ -190,11 +196,6 @@ def __init__(self, synchronize_feature_flag, synchronize_segment, feature_flag_q
190196
self._worker = None
191197
self._feature_flag_storage = feature_flag_storage
192198
self._segment_storage = segment_storage
193-
self._compression_handlers = {
194-
CompressionMode.NO_COMPRESSION: lambda event: base64.b64decode(event.feature_flag_definition),
195-
CompressionMode.GZIP_COMPRESSION: lambda event: gzip.decompress(base64.b64decode(event.feature_flag_definition)).decode('utf-8'),
196-
CompressionMode.ZLIB_COMPRESSION: lambda event: zlib.decompress(base64.b64decode(event.feature_flag_definition)).decode('utf-8'),
197-
}
198199
self._telemetry_runtime_producer = telemetry_runtime_producer
199200

200201
def is_running(self):
@@ -233,13 +234,11 @@ def _run(self):
233234
continue
234235
except Exception as e:
235236
_LOGGER.error('Exception raised in updating feature flag')
236-
_LOGGER.debug(str(e))
237237
_LOGGER.debug('Exception information: ', exc_info=True)
238238
pass
239239
self._handler(event.change_number)
240240
except Exception as e: # pylint: disable=broad-except
241241
_LOGGER.error('Exception raised in feature flag synchronization')
242-
_LOGGER.debug(str(e))
243242
_LOGGER.debug('Exception information: ', exc_info=True)
244243

245244
def start(self):
@@ -290,11 +289,6 @@ def __init__(self, synchronize_feature_flag, synchronize_segment, feature_flag_q
290289
self._running = False
291290
self._feature_flag_storage = feature_flag_storage
292291
self._segment_storage = segment_storage
293-
self._compression_handlers = {
294-
CompressionMode.NO_COMPRESSION: lambda event: base64.b64decode(event.feature_flag_definition),
295-
CompressionMode.GZIP_COMPRESSION: lambda event: gzip.decompress(base64.b64decode(event.feature_flag_definition)).decode('utf-8'),
296-
CompressionMode.ZLIB_COMPRESSION: lambda event: zlib.decompress(base64.b64decode(event.feature_flag_definition)).decode('utf-8'),
297-
}
298292
self._telemetry_runtime_producer = telemetry_runtime_producer
299293

300294
def is_running(self):
@@ -333,13 +327,11 @@ async def _run(self):
333327
continue
334328
except Exception as e:
335329
_LOGGER.error('Exception raised in updating feature flag')
336-
_LOGGER.debug(str(e))
337330
_LOGGER.debug('Exception information: ', exc_info=True)
338331
pass
339332
await self._handler(event.change_number)
340333
except Exception as e: # pylint: disable=broad-except
341334
_LOGGER.error('Exception raised in split synchronization')
342-
_LOGGER.debug(str(e))
343335
_LOGGER.debug('Exception information: ', exc_info=True)
344336

345337
def start(self):

splitio/sync/telemetry.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
"""Telemetry Sync Class."""
22
import abc
33

4-
from splitio.api.telemetry import TelemetryAPI
5-
from splitio.engine.telemetry import TelemetryStorageConsumer
6-
from splitio.models.telemetry import UpdateFromSSE
7-
84
class TelemetrySynchronizer(object):
95
"""Telemetry synchronizer class."""
106

0 commit comments

Comments
 (0)