vitess.io/vitess@v0.16.2/go/vt/vtadmin/cluster/trace.go (about) 1 /* 2 Copyright 2021 The Vitess Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package cluster 18 19 import ( 20 "strings" 21 22 "vitess.io/vitess/go/trace" 23 "vitess.io/vitess/go/vt/topo/topoproto" 24 "vitess.io/vitess/go/vt/vtadmin/vtadminproto" 25 26 vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata" 27 ) 28 29 // AnnotateSpan adds the cluster_id and cluster_name to a span. 30 func AnnotateSpan(c *Cluster, span trace.Span) { 31 vtadminproto.AnnotateClusterSpan(c.ToProto(), span) 32 // (TODO:@ajm188) add support for discovery impls to add annotations to a 33 // span, like `discovery_impl` and any parameters that might be relevant. 34 } 35 36 // (TODO: @ajm188) perhaps we want a ./go/vt/vtctl/vtctlproto package for this? 37 func annotateGetSchemaRequest(req *vtctldatapb.GetSchemaRequest, span trace.Span) { 38 if req.TabletAlias != nil { 39 span.Annotate("tablet_alias", topoproto.TabletAliasString(req.TabletAlias)) 40 } 41 42 span.Annotate("exclude_tables", strings.Join(req.ExcludeTables, ",")) 43 span.Annotate("tables", strings.Join(req.Tables, ",")) 44 span.Annotate("include_views", req.IncludeViews) 45 span.Annotate("table_names_only", req.TableNamesOnly) 46 span.Annotate("table_sizes_only", req.TableSizesOnly) 47 span.Annotate("table_schema_only", req.TableSchemaOnly) 48 }