Skip to content

Instantly share code, notes, and snippets.

@cornet
Forked from chrisa/gist:1877183
Created February 21, 2012 17:07
Show Gist options
  • Save cornet/1877458 to your computer and use it in GitHub Desktop.
Save cornet/1877458 to your computer and use it in GitHub Desktop.
diff -urN carbon-0.9.9/lib/carbon/protocols.py carbon-0.9.9-logpatch/lib/carbon/protocols.py
--- carbon-0.9.9/lib/carbon/protocols.py 2011-10-05 10:28:41.000000000 +0100
+++ carbon-0.9.9-logpatch/lib/carbon/protocols.py 2012-02-20 09:40:37.058970858 +0000
@@ -13,7 +13,6 @@
"""
def connectionMade(self):
self.peerName = self.getPeerName()
- log.listener("%s connection with %s established" % (self.__class__.__name__, self.peerName))
if state.metricReceiversPaused:
self.pauseReceiving()
@@ -36,9 +35,7 @@
self.transport.resumeProducing()
def connectionLost(self, reason):
- if reason.check(ConnectionDone):
- log.listener("%s connection with %s closed cleanly" % (self.__class__.__name__, self.peerName))
- else:
+ if not(reason.check(ConnectionDone)):
log.listener("%s connection with %s lost: %s" % (self.__class__.__name__, self.peerName, reason.value))
state.connectedMetricReceiverProtocols.remove(self)
@@ -103,13 +100,10 @@
def connectionMade(self):
peer = self.transport.getPeer()
self.peerAddr = "%s:%d" % (peer.host, peer.port)
- log.query("%s connected" % self.peerAddr)
self.unpickler = get_unpickler(insecure=settings.USE_INSECURE_UNPICKLER)
def connectionLost(self, reason):
- if reason.check(ConnectionDone):
- log.query("%s disconnected" % self.peerAddr)
- else:
+ if not(reason.check(ConnectionDone)):
log.query("%s connection lost: %s" % (self.peerAddr, reason.value))
def stringReceived(self, rawRequest):
@@ -118,7 +112,6 @@
metric = request['metric']
datapoints = MetricCache.get(metric, [])
result = dict(datapoints=datapoints)
- log.query('[%s] cache query for \"%s\" returned %d values' % (self.peerAddr, metric, len(datapoints)))
instrumentation.increment('cacheQueries')
elif request['type'] == 'get-metadata':
diff -urN carbon-0.9.9/lib/carbon/writer.py carbon-0.9.9-logpatch/lib/carbon/writer.py
--- carbon-0.9.9/lib/carbon/writer.py 2011-10-05 10:39:22.000000000 +0100
+++ carbon-0.9.9-logpatch/lib/carbon/writer.py 2012-02-20 09:38:42.794984619 +0000
@@ -44,7 +44,6 @@
t = time.time()
metrics.sort(key=lambda item: item[1], reverse=True) # by queue size, descending
- log.msg("Sorted %d cache queues in %.6f seconds" % (len(metrics), time.time() - t))
if state.cacheTooFull and MetricCache.size < CACHE_SIZE_LOW_WATERMARK:
events.cacheSpaceAvailable()
@@ -125,6 +124,7 @@
t2 = time.time()
updateTime = t2 - t1
except:
+ log.msg("Error writing to %s" % (dbFilePath))
log.err()
instrumentation.increment('errors')
else:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment