Skip to content

Commit

Permalink
fix graphite pusher when stat functions return dictionaries
Browse files Browse the repository at this point in the history
  • Loading branch information
robbywalker committed Jul 31, 2012
1 parent 1d4a3f8 commit 4c32cdc
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/greplin/scales/graphite.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,19 @@ def push(self, statsDict=None, prefix=None, path=None):
if self._pruned(subpath):
continue

if hasattr(value, '__call__'):
try:
value = value()
except: # pylint: disable=W0702
value = None
logging.exception('Error when calling stat function for graphite push')

if hasattr(value, 'iteritems'):
self.push(value, '%s%s.' % (prefix, self._sanitize(name)), subpath)
else:
if hasattr(value, '__call__'):
try:
value = value()
except: # pylint: disable=W0702
value = None
logging.exception('Error when calling stat function for graphite push')
if self._forbidden(subpath, value):
continue
elif type(value) in [int, long, float] and len(name) < 500:
self.graphite.log(prefix + self._sanitize(name), value)
elif self._forbidden(subpath, value):
continue
elif type(value) in (int, long, float) and len(name) < 500:
self.graphite.log(prefix + self._sanitize(name), value)


def _addRule(self, isWhitelist, rule):
Expand Down

0 comments on commit 4c32cdc

Please sign in to comment.