xrmx / uwsgitop

top-like app for monitoring uWSGI instances

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSONDecode Error

opened this issue · comments

uWSGI (2.0.12)
uwsgitop (0.9)

Using either python34 or python27 I get the following:

[root@blackbox nginx]# uwsgitop /home/idbill/flask/toystore.sock 
Traceback (most recent call last):
  File "/bin/uwsgitop", line 171, in <module>
    dd = json.loads(js)
  File "/usr/lib64/python2.7/site-packages/simplejson/__init__.py", line 516, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.7/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib64/python2.7/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
(venv)[idbill@blackbox flask]$ uwsgitop  toystore.sock 
Traceback (most recent call last):
  File "/home/idbill/flask/venv/bin/uwsgitop", line 171, in <module>
    dd = json.loads(js)
  File "/opt/rh/rh-python34/root/usr/lib64/python3.4/site-packages/simplejson/__init__.py", line 505, in loads
    return _default_decoder.decode(s)
  File "/opt/rh/rh-python34/root/usr/lib64/python3.4/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/opt/rh/rh-python34/root/usr/lib64/python3.4/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
(venv)[idbill@blackbox flask]$ 

That is totally not clear. (on uwsgi docs)

One has to know to enable the stats socket with the following ini config:
stats = app.stats.sock

I hit the issue today. Just to document the solution.

I'm running it as http:

stats = :9000
stats-http = true

It fails with uwsgitop :9000 because uwsgitop connect as wsgi client instead of http client.

Easy fix, pass an http scheme url to it: uwsgitop http://localhost:9000.