New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThreadStatsd crashes when mysql replication thread is stopped #30

Closed
Exus opened this Issue Jan 7, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@Exus

Exus commented Jan 7, 2015

ThreadStatsd is crashing when SQL Slave is down, because slave.seconds_behind_master is Null

Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/home/ex/mysql-statsd/mysql_statsd/thread_statsd.py", line 71, in run
self.send_stat(item)
File "/home/ex/mysql-statsd/mysql_statsd/thread_statsd.py", line 55, in send_stat
sender(k, float(v))
TypeError: float() argument must be a string or a number

Here is workaround:
try:
sender(k, float(v))
except Exception, e:
print "k", k, "v", v
print e

$ python mysql_statsd/mysql_statsd.py -d -f -c ~ex/mysql-statsd.conf
k slave.seconds_behind_master v None
float() argument must be a string or a number

@art-spilgames

This comment has been minimized.

Show comment
Hide comment
@art-spilgames

art-spilgames Jan 7, 2015

Contributor

Hi Exus,

Thanks for reporting this bug.
It is kind of expected when a NULL is sent to the sending of metric it will crash as it explicitly expects a numeric value.
I'll ask Thijs to include the exception.

Art

Contributor

art-spilgames commented Jan 7, 2015

Hi Exus,

Thanks for reporting this bug.
It is kind of expected when a NULL is sent to the sending of metric it will crash as it explicitly expects a numeric value.
I'll ask Thijs to include the exception.

Art

@thijsdezoete

This comment has been minimized.

Show comment
Hide comment
@thijsdezoete

thijsdezoete Jan 13, 2015

Contributor

Question is, is it normal for mysql to give this value? What does that mean? Can we then maybe convert the value to 0 if it's a normal value?

Edit:
Btw, thanks for your bug report @Exus

Contributor

thijsdezoete commented Jan 13, 2015

Question is, is it normal for mysql to give this value? What does that mean? Can we then maybe convert the value to 0 if it's a normal value?

Edit:
Btw, thanks for your bug report @Exus

@art-spilgames

This comment has been minimized.

Show comment
Hide comment
@art-spilgames

art-spilgames Jan 13, 2015

Contributor

@thijsdezoete Yes it is the normal value. The value normally is the seconds the slave is lagging behind its master, however if replication breaks it uses NULL to determine it is broken.

Contributor

art-spilgames commented Jan 13, 2015

@thijsdezoete Yes it is the normal value. The value normally is the seconds the slave is lagging behind its master, however if replication breaks it uses NULL to determine it is broken.

@thijsdezoete

This comment has been minimized.

Show comment
Hide comment
@thijsdezoete

thijsdezoete Jan 13, 2015

Contributor

Ok, and the desired action would be to not send the data(for this specific key) in the case of downtime I guess?

Contributor

thijsdezoete commented Jan 13, 2015

Ok, and the desired action would be to not send the data(for this specific key) in the case of downtime I guess?

@thijsdezoete

This comment has been minimized.

Show comment
Hide comment
@thijsdezoete

thijsdezoete Jan 15, 2015

Contributor

Oops, we merged this one a little soon, but I would still like to verify if this actually solves your issue @Exus

Contributor

thijsdezoete commented Jan 15, 2015

Oops, we merged this one a little soon, but I would still like to verify if this actually solves your issue @Exus

@Exus

This comment has been minimized.

Show comment
Hide comment
@Exus

Exus Jan 16, 2015

Yep, it's fine now

Thanks!

Exus commented Jan 16, 2015

Yep, it's fine now

Thanks!

@Exus Exus closed this Jan 16, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment