Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
Do not stop collecting mysql statistics because of timeout (#1346)
Browse files Browse the repository at this point in the history
  • Loading branch information
chpfm authored Sep 26, 2023
1 parent abd01f3 commit 5ee7c96
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions modules/mysql/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package mysql
import (
"context"
"database/sql"
"errors"
"fmt"
"strconv"
"strings"
Expand Down Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 5ee7c96

Please sign in to comment.