From 396fed66c01c50b0b6d4eb1404dabf6cefef0114 Mon Sep 17 00:00:00 2001 From: "Tim Daly, Jr" Date: Wed, 10 Apr 2013 04:07:43 +0000 Subject: [PATCH] disable db handlers, update config --- tomograph/backends/zipkin/zipkin.py | 14 +++++++++++--- tomograph/config.py | 26 ++++++++++++-------------- tomograph/tomograph.py | 5 +++-- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/tomograph/backends/zipkin/zipkin.py b/tomograph/backends/zipkin/zipkin.py index fa88113..988b850 100644 --- a/tomograph/backends/zipkin/zipkin.py +++ b/tomograph/backends/zipkin/zipkin.py @@ -44,6 +44,7 @@ def send(span): ip = '0.0.0.0' return zipkin_thrift.Endpoint(ipv4 = ip_to_i32(ip), port = note.port, + service_name = note.service_name) def annotation(note): return zipkin_thrift.Annotation(timestamp = int(note.time * 1e6), @@ -55,13 +56,20 @@ def send(span): name = span.name, parent_id = span.parent_id, annotations = [annotation(n) for n in span.notes]) - + print "zspan is {0}".format(zspan) out = StringIO.StringIO() raw = TBinaryProtocol.TBinaryProtocolAccelerated(out) - zspan.write(raw) + try: + zspan.write(raw) + except OverflowError: + traceback.print_exc() scribe_sender.send('zipkin', base64.b64encode(out.getvalue())) 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) + a = -0x80000000 + (IPy.IP(ip_str).int() & 0x7fffffff) + if not -2147483648 <= a <= 2147483647: + print "ARGARG {0}".format(a) + return a + diff --git a/tomograph/config.py b/tomograph/config.py index d4417f9..7b8439b 100644 --- a/tomograph/config.py +++ b/tomograph/config.py @@ -18,6 +18,18 @@ enabled_backends = ['tomograph.backends.zipkin', 'tomograph.backends.log'] backend_modules = [] +zipkin_host = '127.0.0.1' +zipkin_port = 1463 + +statsd_host = 'pairsscares.corp.gq1.yahoo.com' +statsd_port = 8125 + +zipkin_socket_timeout = 5.0 +zipkin_max_queue_length = 50000 +zipkin_target_write_size = 1000 + +debug = False + def set_backends(backends): """ Set the list of enabled backends. Backend name should be the full @@ -44,17 +56,3 @@ def get_backends(): set_backends(enabled_backends) return backend_modules -zipkin_host = '127.0.0.1' -zipkin_port = 1463 - -# zipkin_port = 9410 - -#statsd_host = '127.0.0.1' -statsd_host = 'pairsscares.corp.gq1.yahoo.com' -statsd_port = 8125 - -zipkin_socket_timeout = 5.0 -zipkin_max_queue_length = 50000 -zipkin_target_write_size = 1000 - -debug = False diff --git a/tomograph/tomograph.py b/tomograph/tomograph.py index 0afb747..5e99dc5 100644 --- a/tomograph/tomograph.py +++ b/tomograph/tomograph.py @@ -103,13 +103,14 @@ def before_execute(name): port = conn.connection.connection.port #print >>sys.stderr, 'connection is {0}:{1}'.format(h, port) #print >>sys.stderr, 'sql statement is {0}'.format(clauseelement) - start(str(name) + 'db client', 'execute', h, port) + #start(str(name) + 'db client', 'execute', h, port) return handler def after_execute(name): # name isn't used, at least not yet... def handler(conn, clauseelement, multiparams, params, result): - stop('execute') + #stop('execute') + pass return handler ## http helpers