Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

telemetry: Log error reason for failure to get SQL Metric (#40778) #41137

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion telemetry/data_feature_usage.go
Original file line number Diff line number Diff line change
@@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about make it more clear, for example something like: 'Failed to get cluster index usage'?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized this is a cherry-pick. Please ignore this comment

return nil, err
}

2 changes: 1 addition & 1 deletion telemetry/data_slow_query.go
Original file line number Diff line number Diff line change
@@ -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
}

4 changes: 3 additions & 1 deletion telemetry/data_window.go
Original file line number Diff line number Diff line change
@@ -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)