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

Merged
merged 5 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/pingcap/tidb/util/memory"
"github.com/pingcap/tidb/util/sqlexec"
"github.com/tikv/client-go/v2/metrics"
"go.uber.org/zap"
)

// emptyClusterIndexUsage is empty ClusterIndexUsage, deprecated.
Expand Down Expand Up @@ -80,7 +81,7 @@ func getFeatureUsage(ctx context.Context, sctx sessionctx.Context) (*featureUsag
var err error
usage.NewClusterIndex, usage.ClusterIndex, err = getClusterIndexUsageInfo(ctx, sctx)
if err != nil {
logutil.BgLogger().Info(err.Error())
logutil.BgLogger().Info("Failed to get feature usage", zap.Error(err))
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion telemetry/data_slow_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var (
func getSlowQueryStats() (*slowQueryStats, error) {
slowQueryBucket, err := getSlowQueryBucket()
if err != nil {
logutil.BgLogger().Info(err.Error())
logutil.BgLogger().Info("Failed to get Slow Query Stats", zap.Error(err))
return nil, err
}

Expand Down
4 changes: 3 additions & 1 deletion telemetry/data_window.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -253,7 +254,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)
Expand Down