Since we are not really following the OT conventions for
span annotation, I'm removing this method.

Signed-off-by: Andres Taylor <antaylor@squareup.com>
This commit is contained in:
Andres Taylor 2019-04-12 17:23:45 +02:00
Родитель 459756c74d
Коммит d507fef7b9
3 изменённых файлов: 3 добавлений и 15 удалений

Просмотреть файл

@ -58,15 +58,6 @@ func AnnotateSQL(span Span, sql string) {
span.Annotate("sql-statement-type", sqlparser.StmtType(sqlparser.Preview(sql))) span.Annotate("sql-statement-type", sqlparser.StmtType(sqlparser.Preview(sql)))
} }
// NewClientSpan returns a span and a context to register calls to dependent services.
func NewClientSpan(inCtx context.Context, serviceName, spanLabel string) (Span, context.Context) {
parent, _ := spanFactory.FromContext(inCtx)
span := spanFactory.NewClientSpan(parent, serviceName, spanLabel)
outCtx := spanFactory.NewContext(inCtx, span)
return span, outCtx
}
// FromContext returns the Span from a Context if present. The bool return // FromContext returns the Span from a Context if present. The bool return
// value indicates whether a Span was present in the Context. // value indicates whether a Span was present in the Context.
func FromContext(ctx context.Context) (Span, bool) { func FromContext(ctx context.Context) (Span, bool) {
@ -104,9 +95,6 @@ type TracingService interface {
// New creates a new span from an existing one, if provided. The parent can also be nil // New creates a new span from an existing one, if provided. The parent can also be nil
New(parent Span, label string) Span New(parent Span, label string) Span
// NewClientSpan creates a span for a service call
NewClientSpan(parent Span, serviceName, label string) Span
// Extracts a span from a context, making it possible to annotate the span with additional information. // Extracts a span from a context, making it possible to annotate the span with additional information.
FromContext(ctx context.Context) (Span, bool) FromContext(ctx context.Context) (Span, bool)

Просмотреть файл

@ -123,7 +123,7 @@ func NewExecutor(ctx context.Context, serv srvtopo.Server, cell, statsName strin
// Execute executes a non-streaming query. // Execute executes a non-streaming query.
func (e *Executor) Execute(ctx context.Context, method string, safeSession *SafeSession, sql string, bindVars map[string]*querypb.BindVariable) (result *sqltypes.Result, err error) { func (e *Executor) Execute(ctx context.Context, method string, safeSession *SafeSession, sql string, bindVars map[string]*querypb.BindVariable) (result *sqltypes.Result, err error) {
span, ctx := trace.NewClientSpan(ctx, "mysql", "executor.Execute") span, ctx := trace.NewSpan(ctx, "executor.Execute")
span.Annotate("method", method) span.Annotate("method", method)
trace.AnnotateSQL(span, sql) trace.AnnotateSQL(span, sql)
defer span.Finish() defer span.Finish()

Просмотреть файл

@ -94,7 +94,7 @@ func NewDBConnNoPool(params *mysql.ConnParams, dbaPool *dbconnpool.ConnectionPoo
// Exec executes the specified query. If there is a connection error, it will reconnect // Exec executes the specified query. If there is a connection error, it will reconnect
// and retry. A failed reconnect will trigger a CheckMySQL. // and retry. A failed reconnect will trigger a CheckMySQL.
func (dbc *DBConn) Exec(ctx context.Context, query string, maxrows int, wantfields bool) (*sqltypes.Result, error) { func (dbc *DBConn) Exec(ctx context.Context, query string, maxrows int, wantfields bool) (*sqltypes.Result, error) {
span, ctx := trace.NewClientSpan(ctx,"tabletserver", "DBConn.Exec") span, ctx := trace.NewSpan(ctx,"DBConn.Exec")
defer span.Finish() defer span.Finish()
for attempt := 1; attempt <= 2; attempt++ { for attempt := 1; attempt <= 2; attempt++ {
@ -160,7 +160,7 @@ func (dbc *DBConn) ExecOnce(ctx context.Context, query string, maxrows int, want
// Stream executes the query and streams the results. // Stream executes the query and streams the results.
func (dbc *DBConn) Stream(ctx context.Context, query string, callback func(*sqltypes.Result) error, streamBufferSize int, includedFields querypb.ExecuteOptions_IncludedFields) error { func (dbc *DBConn) Stream(ctx context.Context, query string, callback func(*sqltypes.Result) error, streamBufferSize int, includedFields querypb.ExecuteOptions_IncludedFields) error {
span, ctx := trace.NewClientSpan(ctx, "mysql", "DBConn.Stream") span, ctx := trace.NewSpan(ctx, "DBConn.Stream")
trace.AnnotateSQL(span, query) trace.AnnotateSQL(span, query)
defer span.Finish() defer span.Finish()