Skip to content

Commit

Permalink
Add better error message to graphite unpack failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Garrett Heel committed Dec 20, 2016
1 parent 865f813 commit f553f34
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion graphite_beacon/graphite.py
@@ -1,7 +1,13 @@
class GraphiteRecord(object):

def __init__(self, metric_string, default_nan_value=None, ignore_nan=False):
meta, data = metric_string.split('|')
try:
meta, data = metric_string.split('|')
except ValueError:
peek = ((metric_string[:40] + '..')
if len(metric_string) > 40 else metric_string)
raise ValueError("Unable to parse graphite record: {}".format(peek))

self.target, start_time, end_time, step = meta.rsplit(',', 3)
self.start_time = int(start_time)
self.end_time = int(end_time)
Expand Down

0 comments on commit f553f34

Please sign in to comment.