2626 AllKeysSplit , CacheBasedSplitFetcher
2727from splitio .segments import ApiSegmentChangeFetcher , \
2828 SelfRefreshingSegmentFetcher , JSONFileSegmentFetcher
29- from splitio .config import DEFAULT_CONFIG , MAX_INTERVAL , parse_config_file
29+ from splitio .config import DEFAULT_CONFIG , MAX_INTERVAL , parse_config_file , \
30+ set_machine_ip , set_machine_name
3031from splitio .uwsgi import UWSGISplitCache , UWSGIImpressionsCache , \
3132 UWSGIMetricsCache , UWSGIEventsCache , get_uwsgi
3233from splitio .tasks import EventsSyncTask
@@ -79,13 +80,13 @@ def get_change_number(self):
7980 """
8081 return self .get_split_fetcher ().change_number
8182
82- def log_impression (self , impression ):
83+ def log_impressions (self , impressions ):
8384 """
84- Logs an impression after a get_treatment call
85+ Logs impressions after a get_treatments call
8586 :return: The treatment log implementation.
8687 :rtype: TreatmentLog
8788 """
88- return self .get_impression_log ().log ( impression )
89+ return self .get_impression_log ().log_impressions ( impressions )
8990
9091 def log_operation_time (self , operation , elapsed ):
9192 """Get the metrics implementation.
@@ -120,6 +121,7 @@ def get_events_log(self):
120121 def destroy (self ):
121122 pass
122123
124+
123125class JSONFileBroker (BaseBroker ):
124126 def __init__ (self , config , segment_changes_file_name , split_changes_file_name ):
125127 """
@@ -138,8 +140,8 @@ def __init__(self, config, segment_changes_file_name, split_changes_file_name):
138140 self ._segment_changes_file_name = segment_changes_file_name
139141 self ._split_changes_file_name = split_changes_file_name
140142 self ._split_fetcher = self ._build_split_fetcher ()
141- self ._treatment_log = TreatmentLog () # Does nothing on ._log()
142- self ._metrics = Metrics () # Does nothing on .count(), .time(), .gauge()
143+ self ._treatment_log = TreatmentLog () # Does nothing on ._log()
144+ self ._metrics = Metrics () # Does nothing on .count(), .time(), .gauge()
143145
144146 def _build_split_fetcher (self ):
145147 """
@@ -183,6 +185,7 @@ def destroy(self):
183185 def get_events_log (self ):
184186 return None
185187
188+
186189class SelfRefreshingBroker (BaseBroker ):
187190 def __init__ (self , api_key , config = None , sdk_api_base_url = None ,
188191 events_api_base_url = None , impression_listener = None ):
@@ -488,7 +491,7 @@ def get_events_log(self):
488491 def refresh_splits (self ):
489492 while not self ._destroyed :
490493 time .sleep (self ._split_refresh_period )
491- if not self ._destroyed : # DO NOT REMOVE
494+ if not self ._destroyed : # DO NOT REMOVE
492495 # This check is used in case the client was
493496 # destroyed while the thread was sleeping
494497 # and the file was closed, in order to
@@ -590,7 +593,6 @@ def __init__(self, uwsgi, config=None):
590593 self ._treatment_log = treatment_log
591594 self ._metrics = metrics
592595
593-
594596 def get_split_fetcher (self ):
595597 """
596598 Get the split fetcher implementation for the broker.
@@ -640,6 +642,9 @@ def _init_config(api_key, **kwargs):
640642 file_config .update (config )
641643 config = file_config
642644
645+ set_machine_ip (config .get ('splitSdkMachineIp' ))
646+ set_machine_name (config .get ('splitSdkMachineName' ))
647+
643648 return api_key , config , sdk_api_base_url , events_api_base_url
644649
645650
0 commit comments