synthesize icon indicating copy to clipboard operation
synthesize copied to clipboard

Statsite not writing to Graphite v4.0.0 xrange and StandardError not defined

Open hkp opened this issue 4 years ago • 2 comments

Did a fresh install of the v4.0.0 tagged and master branch.

Statsite was not flushing to Graphite. I found this error in the syslog.

Jul 11 21:34:07 ubuntu-bionic statsite[28695]: Traceback (most recent call last): Jul 11 21:34:07 ubuntu-bionic statsite[28695]: File "/usr/local/sbin/statsite-sink-graphite.py", line 102, in flush_lines Jul 11 21:34:07 ubuntu-bionic statsite[28695]: self._write_metric(data) Jul 11 21:34:07 ubuntu-bionic statsite[28695]: File "/usr/local/sbin/statsite-sink-graphite.py", line 156, in _write_metric Jul 11 21:34:07 ubuntu-bionic statsite[28695]: for _ in xrange(self.attempts): Jul 11 21:34:07 ubuntu-bionic statsite[28695]: NameError: name 'xrange' is not defined Jul 11 21:34:07 ubuntu-bionic statsite[28695]: During handling of the above exception, another exception occurred: Jul 11 21:34:07 ubuntu-bionic statsite[28695]: Traceback (most recent call last): Jul 11 21:34:07 ubuntu-bionic statsite[28695]: File "/usr/local/sbin/statsite-sink-graphite.py", line 186, in Jul 11 21:34:07 ubuntu-bionic statsite[28695]: main() Jul 11 21:34:07 ubuntu-bionic statsite[28695]: File "/usr/local/sbin/statsite-sink-graphite.py", line 182, in main Jul 11 21:34:07 ubuntu-bionic statsite[28695]: graphite.send_metrics() Jul 11 21:34:07 ubuntu-bionic statsite[28695]: File "/usr/local/sbin/statsite-sink-graphite.py", line 87, in send_metrics Jul 11 21:34:07 ubuntu-bionic statsite[28695]: self.flush() Jul 11 21:34:07 ubuntu-bionic statsite[28695]: File "/usr/local/sbin/statsite-sink-graphite.py", line 103, in flush_lines Jul 11 21:34:07 ubuntu-bionic statsite[28695]: except StandardError: Jul 11 21:34:07 ubuntu-bionic statsite[28695]: NameError: name 'StandardError' is not defined Jul 11 21:34:07 ubuntu-bionic statsite[28695]: statsite[28695]: Streaming command exited with status 1 Jul 11 21:34:07 ubuntu-bionic statsite[28695]: Streaming command exited with status 1

It looks like you're using a Python2 script with Python3, so it's failing.

hkp avatar Jul 11 '20 21:07 hkp

Looking at the way you do the install, you're pulling the script from the statsite repo, so maybe I should submit a patch there to fix the sink to be Python3 compatible. Or you can keep your own python3 compatible version.

hkp avatar Jul 11 '20 22:07 hkp

I sent a pull request that will fix this.

hkp avatar Jul 13 '20 14:07 hkp