diff --git a/modules/mysql/collect.go b/modules/mysql/collect.go index 774462718..3ff0882ad 100644 --- a/modules/mysql/collect.go +++ b/modules/mysql/collect.go @@ -5,6 +5,7 @@ package mysql import ( "context" "database/sql" + "errors" "fmt" "strconv" "strings" @@ -68,17 +69,15 @@ func (m *MySQL) collect() (map[string]int64, error) { // TODO: perhaps make a decisions based on privileges? (SHOW GRANTS FOR CURRENT_USER();) if m.doSlaveStatus { if err := m.collectSlaveStatus(mx); err != nil { - m.Errorf("error on collecting slave status: %v", err) - // TODO: shouldn't disable on any error - m.doSlaveStatus = false + m.Warningf("error on collecting slave status: %v", err) + m.doSlaveStatus = errors.Is(err, context.DeadlineExceeded) } } if m.doUserStatistics { if err := m.collectUserStatistics(mx); err != nil { - m.Errorf("error on collecting user statistics: %v", err) - // TODO: shouldn't disable on any error - m.doUserStatistics = false + m.Warningf("error on collecting user statistics: %v", err) + m.doUserStatistics = errors.Is(err, context.DeadlineExceeded) } }