diff --git a/telemetry/data_slow_query.go b/telemetry/data_slow_query.go index dd73097293e6c..74526f96a18f0 100644 --- a/telemetry/data_slow_query.go +++ b/telemetry/data_slow_query.go @@ -143,7 +143,7 @@ func init() { currentSQBInfo["+Inf"] = 0 if mysql.TiDBReleaseVersion != "None" { - logutil.BgLogger().Info("Telemetry slow query stats initialized", zap.String("currentSQBInfo", currentSQBInfo.String()), zap.String("lastSQBInfo", lastSQBInfo.String())) + logutil.BgLogger().Debug("Telemetry slow query stats initialized", zap.String("currentSQBInfo", currentSQBInfo.String()), zap.String("lastSQBInfo", lastSQBInfo.String())) } } diff --git a/telemetry/data_window.go b/telemetry/data_window.go index 24ebed9ea80bc..e8a429a3134ba 100644 --- a/telemetry/data_window.go +++ b/telemetry/data_window.go @@ -18,7 +18,6 @@ import ( "sync" "time" - "github.com/pingcap/errors" "github.com/pingcap/tidb/domain/infosync" "github.com/prometheus/client_golang/api" promv1 "github.com/prometheus/client_golang/api/prometheus/v1" @@ -110,12 +109,8 @@ func readSQLMetric(timepoint time.Time, SQLResult *sqlUsageData) error { promQL := "sum(tidb_executor_statement_total{}) by (instance,type)" result, err := querySQLMetric(ctx, timepoint, promQL) if err != nil { - if err1, ok := err.(*promv1.Error); ok { - return errors.Errorf("query metric error, msg: %v, detail: %v", err1.Msg, err1.Detail) - } - return errors.Errorf("query metric error: %v", err.Error()) + logutil.BgLogger().Warn("querySQLMetric got error") } - anylisSQLUsage(result, SQLResult) return nil } @@ -155,6 +150,9 @@ func querySQLMetric(ctx context.Context, queryTime time.Time, promQL string) (re } func anylisSQLUsage(promResult pmodel.Value, SQLResult *sqlUsageData) { + if promResult == nil { + return + } switch promResult.Type() { case pmodel.ValVector: matrix := promResult.(pmodel.Vector)