File tree Expand file tree Collapse file tree 2 files changed +10
-15
lines changed
Expand file tree Collapse file tree 2 files changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -32,12 +32,15 @@ def send_entity(self, entity):
3232
3333 :param entity: a trace entity to send to the X-Ray daemon
3434 """
35- message = "%s%s%s" % (PROTOCOL_HEADER ,
36- PROTOCOL_DELIMITER ,
37- entity .serialize ())
35+ try :
36+ message = "%s%s%s" % (PROTOCOL_HEADER ,
37+ PROTOCOL_DELIMITER ,
38+ entity .serialize ())
3839
39- log .debug ("sending: %s to %s:%s." % (message , self ._ip , self ._port ))
40- self ._send_data (message )
40+ log .debug ("sending: %s to %s:%s." % (message , self ._ip , self ._port ))
41+ self ._send_data (message )
42+ except Exception :
43+ log .exception ("Failed to send entity to Daemon." )
4144
4245 def set_daemon_address (self , address ):
4346 """
@@ -57,12 +60,7 @@ def port(self):
5760 return self ._port
5861
5962 def _send_data (self , data ):
60-
61- try :
62- self ._socket .sendto (data .encode ('utf-8' ), (self ._ip ,
63- self ._port ))
64- except Exception :
65- log .exception ('failed to send data to X-Ray daemon.' )
63+ self ._socket .sendto (data .encode ('utf-8' ), (self ._ip , self ._port ))
6664
6765 def _parse_address (self , daemon_address ):
6866 try :
Original file line number Diff line number Diff line change @@ -259,10 +259,7 @@ def serialize(self):
259259 Serialize to JSON document that can be accepted by the
260260 X-Ray backend service. It uses json to perform serialization.
261261 """
262- try :
263- return json .dumps (self .to_dict (), default = str )
264- except Exception :
265- log .exception ("Failed to serialize %s" , self .name )
262+ return json .dumps (self .to_dict (), default = str )
266263
267264 def to_dict (self ):
268265 """
You can’t perform that action at this time.
0 commit comments