Skip to content

Commit

Permalink
MySQL input: log and continue on field parse error (influxdata#2855)
Browse files Browse the repository at this point in the history
  • Loading branch information
m4ce authored and Vladislav Mugultyanov (Lazada Group) committed May 30, 2017
1 parent 54306a9 commit bc1a0bc
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions plugins/inputs/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,42 +858,45 @@ func (m *Mysql) gatherGlobalStatuses(db *sql.DB, serv string, acc telegraf.Accum
case "Queries":
i, err := strconv.ParseInt(string(val.([]byte)), 10, 64)
if err != nil {
return err
acc.AddError(fmt.Errorf("E! Error mysql: parsing %s int value (%s)", name, err))
} else {
fields["queries"] = i
}

fields["queries"] = i
case "Questions":
i, err := strconv.ParseInt(string(val.([]byte)), 10, 64)
if err != nil {
return err
acc.AddError(fmt.Errorf("E! Error mysql: parsing %s int value (%s)", name, err))
} else {
fields["questions"] = i
}

fields["questions"] = i
case "Slow_queries":
i, err := strconv.ParseInt(string(val.([]byte)), 10, 64)
if err != nil {
return err
acc.AddError(fmt.Errorf("E! Error mysql: parsing %s int value (%s)", name, err))
} else {
fields["slow_queries"] = i
}

fields["slow_queries"] = i
case "Connections":
i, err := strconv.ParseInt(string(val.([]byte)), 10, 64)
if err != nil {
return err
acc.AddError(fmt.Errorf("E! Error mysql: parsing %s int value (%s)", name, err))
} else {
fields["connections"] = i
}
fields["connections"] = i
case "Syncs":
i, err := strconv.ParseInt(string(val.([]byte)), 10, 64)
if err != nil {
return err
acc.AddError(fmt.Errorf("E! Error mysql: parsing %s int value (%s)", name, err))
} else {
fields["syncs"] = i
}
fields["syncs"] = i
case "Uptime":
i, err := strconv.ParseInt(string(val.([]byte)), 10, 64)
if err != nil {
return err
acc.AddError(fmt.Errorf("E! Error mysql: parsing %s int value (%s)", name, err))
} else {
fields["uptime"] = i
}
fields["uptime"] = i
}
}
// Send any remaining fields
Expand Down

0 comments on commit bc1a0bc

Please sign in to comment.