@@ -26,7 +26,7 @@ def __init__(self, hostname='localhost', port=7777):
2626 self ._traces = None
2727 self ._services = None
2828 self ._worker = None
29- self ._api = api .API (hostname , port )
29+ self .api = api .API (hostname , port )
3030
3131 def write (self , spans = None , services = None ):
3232 # if the worker needs to be reset, do it.
@@ -51,7 +51,7 @@ def _reset_worker(self):
5151
5252 # ensure we have an active thread working on this queue
5353 if not self ._worker or not self ._worker .is_alive ():
54- self ._worker = AsyncWorker (self ._api , self ._traces , self ._services )
54+ self ._worker = AsyncWorker (self .api , self ._traces , self ._services )
5555
5656
5757class AsyncWorker (object ):
@@ -62,7 +62,7 @@ def __init__(self, api, trace_queue, service_queue, shutdown_timeout=DEFAULT_TIM
6262 self ._lock = threading .Lock ()
6363 self ._thread = None
6464 self ._shutdown_timeout = shutdown_timeout
65- self ._api = api
65+ self .api = api
6666 self .start ()
6767
6868 def is_alive (self ):
@@ -101,14 +101,14 @@ def _target(self):
101101 if traces :
102102 # If we have data, let's try to send it.
103103 try :
104- self ._api .send_traces (traces )
104+ self .api .send_traces (traces )
105105 except Exception :
106106 log .exception ("error sending spans" )
107107
108108 services = self ._service_queue .pop ()
109109 if services :
110110 try :
111- self ._api .send_services (services )
111+ self .api .send_services (services )
112112 except Exception :
113113 log .exception ("error sending spans" )
114114
0 commit comments