From d73f5460da538e24fe71671544a502448f463439 Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Fri, 6 Sep 2024 21:59:24 -0400 Subject: [PATCH] Add span annotations Signed-off-by: Matt Lord --- .../vtctldclient/command/vreplication/common/utils.go | 2 +- go/vt/vtctl/grpcvtctldserver/server.go | 4 ++++ go/vt/vtctl/workflow/server.go | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/go/cmd/vtctldclient/command/vreplication/common/utils.go b/go/cmd/vtctldclient/command/vreplication/common/utils.go index 135d7719466..6731f425dcf 100644 --- a/go/cmd/vtctldclient/command/vreplication/common/utils.go +++ b/go/cmd/vtctldclient/command/vreplication/common/utils.go @@ -249,7 +249,7 @@ func AddCommonSwitchTrafficFlags(cmd *cobra.Command, initializeTargetSequences b cmd.Flags().DurationVar(&SwitchTrafficOptions.MaxReplicationLagAllowed, "max-replication-lag-allowed", MaxReplicationLagDefault, "Allow traffic to be switched only if VReplication lag is below this.") cmd.Flags().BoolVar(&SwitchTrafficOptions.EnableReverseReplication, "enable-reverse-replication", true, "Setup replication going back to the original source keyspace to support rolling back the traffic cutover.") cmd.Flags().BoolVar(&SwitchTrafficOptions.DryRun, "dry-run", false, "Print the actions that would be taken and report any known errors that would have occurred.") - cmd.Flags().BoolVar(&SwitchTrafficOptions.Force, "force", false, "Force the traffic switch even if some non-critical actions cannot be performed; for example tablet refresh fails on some tablets in the keyspace. WARNING: this should be used with extreme caution and only in emergency situations.") + cmd.Flags().BoolVar(&SwitchTrafficOptions.Force, "force", false, "Force the traffic switch even if some non-critical actions cannot be performed; for example tablet refresh fails on some tablets in the keyspace. WARNING: this should be used with extreme caution and only in emergency situations!") if initializeTargetSequences { cmd.Flags().BoolVar(&SwitchTrafficOptions.InitializeTargetSequences, "initialize-target-sequences", false, "When moving tables from an unsharded keyspace to a sharded keyspace, initialize any sequences that are being used on the target when switching writes.") } diff --git a/go/vt/vtctl/grpcvtctldserver/server.go b/go/vt/vtctl/grpcvtctldserver/server.go index f5d33b1a3f4..1fab9e4091e 100644 --- a/go/vt/vtctl/grpcvtctldserver/server.go +++ b/go/vt/vtctl/grpcvtctldserver/server.go @@ -5155,6 +5155,9 @@ func (s *VtctldServer) WorkflowDelete(ctx context.Context, req *vtctldatapb.Work span.Annotate("keyspace", req.Keyspace) span.Annotate("workflow", req.Workflow) + span.Annotate("keep_data", req.KeepData) + span.Annotate("keep_routing_rules", req.KeepRoutingRules) + span.Annotate("shards", req.Shards) resp, err = s.ws.WorkflowDelete(ctx, req) return resp, err @@ -5186,6 +5189,7 @@ func (s *VtctldServer) WorkflowSwitchTraffic(ctx context.Context, req *vtctldata span.Annotate("tablet-types", req.TabletTypes) span.Annotate("direction", req.Direction) span.Annotate("enable-reverse-replication", req.EnableReverseReplication) + span.Annotate("force", req.Force) resp, err = s.ws.WorkflowSwitchTraffic(ctx, req) return resp, err diff --git a/go/vt/vtctl/workflow/server.go b/go/vt/vtctl/workflow/server.go index 8330a788b3c..18fa0feb388 100644 --- a/go/vt/vtctl/workflow/server.go +++ b/go/vt/vtctl/workflow/server.go @@ -3055,6 +3055,16 @@ func (s *Server) finalizeMigrateWorkflow(ctx context.Context, ts *trafficSwitche // WorkflowSwitchTraffic switches traffic in the direction passed for specified tablet types. func (s *Server) WorkflowSwitchTraffic(ctx context.Context, req *vtctldatapb.WorkflowSwitchTrafficRequest) (*vtctldatapb.WorkflowSwitchTrafficResponse, error) { + span, ctx := trace.NewSpan(ctx, "workflow.Server.WorkflowSwitchTraffic") + defer span.Finish() + + span.Annotate("keyspace", req.Keyspace) + span.Annotate("workflow", req.Workflow) + span.Annotate("tablet-types", req.TabletTypes) + span.Annotate("direction", req.Direction) + span.Annotate("enable-reverse-replication", req.EnableReverseReplication) + span.Annotate("force", req.Force) + var ( dryRunResults []string rdDryRunResults, wrDryRunResults *[]string