raintank / graphite-api

Graphite-web, without the interface. Just the rendering HTTP API.
http://graphite-api.readthedocs.org
Apache License 2.0
1 stars 1 forks source link

ValueError: Extra data: line 1 column 2573 - line 1 column 40662 (char 2572 - 40661) #12

Closed Dieterbe closed 8 years ago

Dieterbe commented 8 years ago

on https://app.raintank.io/dashboard/file/rt-endpoint-summary.json?var-collector=All&var-endpoint=dieter_plaetinck_be looking at last 60 days , all graphs load fine except for dns uptime percentage (note: errors and latency graph works fine)

Traceback (most recent call last):
  File "/usr/share/python/graphite/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/share/python/graphite/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/share/python/graphite/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/share/python/graphite/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/share/python/graphite/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/share/python/graphite/local/lib/python2.7/site-packages/graphite_api/app.py", line 384, in render
    data_store = fetchData(context, paths)
  File "/usr/share/python/graphite/local/lib/python2.7/site-packages/graphite_api/render/datalib.py", line 160, in fetchData
    time_info, series = finder.fetch_multi(nodes, startTime, endTime)
  File "/usr/share/python/graphite/local/lib/python2.7/site-packages/graphite_raintank.py", line 186, in fetch_multi
    data = self.fetch_from_tank(nodes, start_time, end_time)
  File "/usr/share/python/graphite/local/lib/python2.7/site-packages/graphite_raintank.py", line 220, in fetch_from_tank
    for result in resp.json():
  File "/usr/share/python/graphite/local/lib/python2.7/site-packages/requests/models.py", line 800, in json
    self.content.decode(encoding), **kwargs
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 369, in decode
    raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column 2573 - line 1 column 40662 (char 2572 - 40661)

req

DanCech commented 8 years ago

That error message is raised when there is extra junk in the source string after the json.

DanCech commented 8 years ago

You can see what the raw response looks like by enabling debug logging in graphite_api and seeing what the fetch_from_tank entry spits out on line 217 in graphite_raintank.py.

Looking at the graphiteJSON function in metric_tank/http.go it looks like there could be scenarios where the JSON it produces is invalid since it never actually checks that an array is non-empty before chopping off the trailing comma, I'm not sure if that could be the cause of this issue though.

Dieterbe commented 8 years ago

that's probably it. will write tests and fix.