fix deprecation warning from pack()

This commit is contained in:
Tim Daly, Jr
2013-04-04 23:25:58 +00:00
parent 83e650355d
commit a4a73746af

View File

@@ -28,6 +28,7 @@ import traceback
def send(span): def send(span):
tsocket = TSocket.TSocket(config.zipkin_host, config.zipkin_port) tsocket = TSocket.TSocket(config.zipkin_host, config.zipkin_port)
transport = TTransport.TFramedTransport(tsocket) transport = TTransport.TFramedTransport(tsocket)
@@ -41,7 +42,7 @@ def send(span):
except: except:
print >>sys.stderr, 'host resolution error: ', traceback.format_exc() print >>sys.stderr, 'host resolution error: ', traceback.format_exc()
ip = '0.0.0.0' ip = '0.0.0.0'
return zipkin_thrift.Endpoint(ipv4 = IPy.IP(ip).int(), return zipkin_thrift.Endpoint(ipv4 = ip_to_i32(ip),
port = note.port, port = note.port,
service_name = note.service_name) service_name = note.service_name)
def annotation(note): def annotation(note):
@@ -61,3 +62,7 @@ def send(span):
logentry = scribe.LogEntry('zipkin', base64.b64encode(out.getvalue())) logentry = scribe.LogEntry('zipkin', base64.b64encode(out.getvalue()))
client.Log([logentry]) client.Log([logentry])
transport.close() transport.close()
def ip_to_i32(ip_str):
"""convert an ip address from a string to a signed 32-bit number"""
return -0x80000000 + (IPy.IP(ip_str).int() & 0x7fffffff)