Skip to content

Fixing some buggy data handling, add some logging #17

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,16 @@ def fetch_innodb_stats(conn):
# 205 lock struct(s), heap size 30248, 37 row lock(s), undo log entries 1
elif line.find("lock struct(s)") != -1:
if line.find("LOCK WAIT") != -1:
stats['innodb_lock_structs'] += int(row[2])
try:
stats['innodb_lock_structs'] += int(row[2])
except ValueError:
pass
stats['locked_transactions'] += 1
else:
stats['innodb_lock_structs'] += int(row[0])
try:
stats['innodb_lock_structs'] += int(row[0])
except ValueError:
pass
else:
for match in MYSQL_INNODB_STATUS_MATCHES:
if line.find(match) == -1: continue
Expand All @@ -496,8 +502,10 @@ def dispatch_value(prefix, key, value, type, type_instance=None):
if not type_instance:
type_instance = key

log_verbose('Sending value: %s/%s=%s' % (prefix, type_instance, value))
if value is None:
log_verbose('Prepping value: %s/%s=%s' % (prefix, type_instance, value))
if not value and value != 0:
log_verbose("value determined to be not sendable, dropping data point.")

return
try:
value = int(value)
Expand All @@ -509,6 +517,7 @@ def dispatch_value(prefix, key, value, type, type_instance=None):
val.type_instance = type_instance
val.values = [value]
val.dispatch()
log_verbose('Dispatching value: %s/%s=%s' % (prefix, type_instance, value))

def configure_callback(conf):
global MYSQL_CONFIG
Expand Down