Skip to content

Commit

Permalink
Fix exception when parsing non numerical items.
Browse files Browse the repository at this point in the history
  • Loading branch information
jordmoz committed Mar 1, 2016
1 parent 96fe35d commit b687cd4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion marathon.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import json
import urllib2
import base64
import numbers

PREFIX = "marathon"
MARATHON_HOST = "localhost"
Expand Down Expand Up @@ -67,7 +68,7 @@ def read_callback():
for group in ['gauges', 'histograms', 'meters', 'timers', 'counters']:
for name,values in metrics.get(group, {}).items():
for metric, value in values.items():
if not isinstance(value, basestring):
if isinstance(value, numbers.Number):
dispatch_stat('gauge', '.'.join((name, metric)), value)
except urllib2.URLError as e:
collectd.error('marathon plugin: Error connecting to %s - %r' % (MARATHON_URL, e))
Expand Down

0 comments on commit b687cd4

Please sign in to comment.