From 9181efadcc2b39ed9d33354b84b83039fb185e43 Mon Sep 17 00:00:00 2001 From: Austen Lacy Date: Mon, 11 Dec 2023 22:01:46 +0000 Subject: [PATCH] more traces Signed-off-by: Austen Lacy --- go/vt/vttablet/grpcqueryservice/server.go | 4 ++++ go/vt/vttablet/queryservice/wrapped.go | 4 ++++ go/vt/vttablet/tabletmanager/rpc_query.go | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/go/vt/vttablet/grpcqueryservice/server.go b/go/vt/vttablet/grpcqueryservice/server.go index bbd8d3a08c0..9cb24a4a4a5 100644 --- a/go/vt/vttablet/grpcqueryservice/server.go +++ b/go/vt/vttablet/grpcqueryservice/server.go @@ -22,6 +22,7 @@ import ( "google.golang.org/grpc" "vitess.io/vitess/go/sqltypes" + "vitess.io/vitess/go/trace" "vitess.io/vitess/go/vt/callerid" "vitess.io/vitess/go/vt/callinfo" "vitess.io/vitess/go/vt/vterrors" @@ -43,6 +44,9 @@ var _ queryservicepb.QueryServer = (*query)(nil) // Execute is part of the queryservice.QueryServer interface func (q *query) Execute(ctx context.Context, request *querypb.ExecuteRequest) (response *querypb.ExecuteResponse, err error) { + span, ctx := trace.NewSpan(ctx, "query.Execute") + defer span.Finish() + defer q.server.HandlePanic(&err) ctx = callerid.NewContext(callinfo.GRPCCallInfo(ctx), request.EffectiveCallerId, diff --git a/go/vt/vttablet/queryservice/wrapped.go b/go/vt/vttablet/queryservice/wrapped.go index 5d3402f7f11..7810b49a83b 100644 --- a/go/vt/vttablet/queryservice/wrapped.go +++ b/go/vt/vttablet/queryservice/wrapped.go @@ -20,6 +20,7 @@ import ( "context" "vitess.io/vitess/go/sqltypes" + "vitess.io/vitess/go/trace" "vitess.io/vitess/go/vt/vterrors" binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata" @@ -177,6 +178,9 @@ func (ws *wrappedService) ReadTransaction(ctx context.Context, target *querypb.T } func (ws *wrappedService) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]*querypb.BindVariable, transactionID, reservedID int64, options *querypb.ExecuteOptions) (qr *sqltypes.Result, err error) { + span, ctx := trace.NewSpan(ctx, "wrappedService.Execute") + defer span.Finish() + inDedicatedConn := transactionID != 0 || reservedID != 0 err = ws.wrapper(ctx, target, ws.impl, "Execute", inDedicatedConn, func(ctx context.Context, target *querypb.Target, conn QueryService) (bool, error) { var innerErr error diff --git a/go/vt/vttablet/tabletmanager/rpc_query.go b/go/vt/vttablet/tabletmanager/rpc_query.go index 835cb698d8b..d5967e739b9 100644 --- a/go/vt/vttablet/tabletmanager/rpc_query.go +++ b/go/vt/vttablet/tabletmanager/rpc_query.go @@ -21,6 +21,7 @@ import ( "vitess.io/vitess/go/sqlescape" "vitess.io/vitess/go/sqltypes" + "vitess.io/vitess/go/trace" "vitess.io/vitess/go/vt/log" "vitess.io/vitess/go/vt/sqlparser" @@ -126,6 +127,9 @@ func (tm *TabletManager) ExecuteFetchAsApp(ctx context.Context, req *tabletmanag // ExecuteQuery submits a new online DDL request func (tm *TabletManager) ExecuteQuery(ctx context.Context, req *tabletmanagerdatapb.ExecuteQueryRequest) (*querypb.QueryResult, error) { + span, ctx := trace.NewSpan(ctx, "TabletManager.ExecuteQuery") + defer span.Finish() + // get the db name from the tablet tablet := tm.Tablet() target := &querypb.Target{Keyspace: tablet.Keyspace, Shard: tablet.Shard, TabletType: tablet.Type}