Skip to content

Commit

Permalink
metric: record prepare execute fail as "Failed Query OPM" in monitor (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Mar 7, 2021
1 parent 649d0e0 commit 31fd1f3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/conn_stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
"github.com/pingcap/errors"
"github.com/pingcap/parser/mysql"
"github.com/pingcap/parser/terror"
"github.com/pingcap/tidb/metrics"
plannercore "github.com/pingcap/tidb/planner/core"
"github.com/pingcap/tidb/sessionctx/stmtctx"
"github.com/pingcap/tidb/types"
Expand Down Expand Up @@ -112,6 +113,11 @@ func (cc *clientConn) handleStmtPrepare(ctx context.Context, sql string) error {

func (cc *clientConn) handleStmtExecute(ctx context.Context, data []byte) (err error) {
defer trace.StartRegion(ctx, "HandleStmtExecute").End()
defer func() {
if err != nil {
metrics.ExecuteErrorCounter.WithLabelValues(metrics.ExecuteErrorToLabel(err)).Inc()
}
}()
if len(data) < 9 {
return mysql.ErrMalformPacket
}
Expand Down

0 comments on commit 31fd1f3

Please sign in to comment.