diff --git a/telemetry/data_feature_usage.go b/telemetry/data_feature_usage.go index 622f25c4b2430..b9a22291d74e4 100644 --- a/telemetry/data_feature_usage.go +++ b/telemetry/data_feature_usage.go @@ -27,6 +27,7 @@ import ( "github.com/pingcap/tidb/util/logutil" "github.com/pingcap/tidb/util/sqlexec" "github.com/tikv/client-go/v2/metrics" + "go.uber.org/zap" ) // emptyClusterIndexUsage is empty ClusterIndexUsage, deprecated. @@ -61,7 +62,7 @@ func getFeatureUsage(ctx sessionctx.Context) (*featureUsage, error) { var err error usage.NewClusterIndex, usage.ClusterIndex, err = getClusterIndexUsageInfo(ctx) if err != nil { - logutil.BgLogger().Info(err.Error()) + logutil.BgLogger().Info("Failed to get feature usage", zap.Error(err)) return nil, err } diff --git a/telemetry/data_slow_query.go b/telemetry/data_slow_query.go index e32940e09be6a..1e77ae9f21948 100644 --- a/telemetry/data_slow_query.go +++ b/telemetry/data_slow_query.go @@ -65,7 +65,7 @@ var ( func getSlowQueryStats(ctx sessionctx.Context) (*slowQueryStats, error) { slowQueryBucket, err := getSlowQueryBucket(ctx) if err != nil { - logutil.BgLogger().Info(err.Error()) + logutil.BgLogger().Info("Failed to get Slow Query Stats", zap.Error(err)) return nil, err } diff --git a/telemetry/data_window.go b/telemetry/data_window.go index 0945326075083..4ca77a274cdce 100644 --- a/telemetry/data_window.go +++ b/telemetry/data_window.go @@ -25,6 +25,7 @@ import ( promv1 "github.com/prometheus/client_golang/api/prometheus/v1" pmodel "github.com/prometheus/common/model" "go.uber.org/atomic" + "go.uber.org/zap" ) var ( @@ -246,7 +247,8 @@ func RotateSubWindow() { err := readSQLMetric(time.Now(), &thisSubWindow.SQLUsage) if err != nil { - logutil.BgLogger().Info("Error exists when getting the SQL Metric.") + logutil.BgLogger().Info("Error exists when getting the SQL Metric.", + zap.Error(err)) } thisSubWindow.SQLUsage.SQLTotal = getSQLSum(&thisSubWindow.SQLUsage.SQLType)