TypeError: unsupported operand type(s) for -: 'str' and 'str'
Closed this issue · 2 comments
Alexhha commented
Hello
I'm using the following veriosn of mysql-statsd on CentOS 6.
# pip list | grep mysql-statsd
mysql-statsd (0.1.4)
When I run mysql_statsd I got the following error after few seconds
# mysql_statsd --config /root/statsd-mysql/mysql-statsd.conf -d --foreground
('status.aborted_connects', '1', 'd')
('status.com_delete', '707701', 'd')
('status.com_insert', '707700', 'd')
('status.com_insert_select', '0', 'd')
...
...
...
('status.threads_created', '90', 'd')
('status.threads_running', '17', 'g')
('variables.max_connections', '151', 'g')
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib64/python2.6/threading.py", line 532, in __bootstrap_inner
self.run()
File "/usr/lib/python2.6/site-packages/mysql_statsd/thread_mysql.py", line 149, in run
self._run()
File "/usr/lib/python2.6/site-packages/mysql_statsd/thread_mysql.py", line 92, in _run
rows = self._preprocess(check_type, column_names, cursor.fetchall())
File "/usr/lib/python2.6/site-packages/mysql_statsd/thread_mysql.py", line 131, in _preprocess
return executing_class.process(rows, *extra_args)
File "/usr/lib/python2.6/site-packages/mysql_statsd/preprocessors/innodb_preprocessor.py", line 66, in process
self.process_line(line)
File "/usr/lib/python2.6/site-packages/mysql_statsd/preprocessors/innodb_preprocessor.py", line 207, in process_line
self.tmp_stats['unpurged_txns'] = self.tmp_stats['innodb_transactions'] - self.make_bigint(innorow[6], innorow[7])
TypeError: unsupported operand type(s) for -: 'str' and 'str'
thijsdezoete commented
Hi @Alexhha, thanks for your bugreport. I've tried to add a quick fix, and hope to be able to make a new release for this tomorrow. You can see the fix here: #36
If you would like to help me test this, could you apply the fix on the machine where the problem is occuring?
That means editing /usr/lib/python2.6/site-packages/mysql_statsd/preprocessors/innodb_preprocessor.py line 207 and incorporate the fix proposed in the pull request like this:
int(self.tmp_stats['innodb_transactions'])
Alexhha commented
Now I'm getting
self.tmp_stats['unpurged_txns'] = int(self.tmp_stats['innodb_transactions']) - self.make_bigint(innorow[6], innorow[7])
TypeError: unsupported operand type(s) for -: 'int' and 'str'