Update vendored library cloud.google.com/go

This commit is contained in:
Alexander Neumann
2018-03-30 11:41:12 +02:00
parent a4ff591165
commit a951e7b126
221 changed files with 19911 additions and 2075 deletions

View File

@@ -19,29 +19,22 @@ package spanner
import (
"fmt"
ocgrpc "go.opencensus.io/plugin/grpc"
"go.opencensus.io/trace"
"golang.org/x/net/context"
"google.golang.org/api/option"
"google.golang.org/grpc"
)
func openCensusOptions() []option.ClientOption {
return []option.ClientOption{
option.WithGRPCDialOption(grpc.WithStatsHandler(ocgrpc.NewClientStatsHandler())),
}
}
func traceStartSpan(ctx context.Context, name string) context.Context {
return trace.StartSpan(ctx, name)
ctx, _ = trace.StartSpan(ctx, name)
return ctx
}
func traceEndSpan(ctx context.Context, err error) {
span := trace.FromContext(ctx)
if err != nil {
// TODO(jba): Add error code to the status.
span.SetStatus(trace.Status{Message: err.Error()})
}
trace.EndSpan(ctx)
span.End()
}
func tracePrintf(ctx context.Context, attrMap map[string]interface{}, format string, args ...interface{}) {
@@ -50,15 +43,15 @@ func tracePrintf(ctx context.Context, attrMap map[string]interface{}, format str
var a trace.Attribute
switch v := v.(type) {
case string:
a = trace.StringAttribute{k, v}
a = trace.StringAttribute(k, v)
case bool:
a = trace.BoolAttribute{k, v}
a = trace.BoolAttribute(k, v)
case int:
a = trace.Int64Attribute{k, int64(v)}
a = trace.Int64Attribute(k, int64(v))
case int64:
a = trace.Int64Attribute{k, v}
a = trace.Int64Attribute(k, v)
default:
a = trace.StringAttribute{k, fmt.Sprintf("%#v", v)}
a = trace.StringAttribute(k, fmt.Sprintf("%#v", v))
}
attrs = append(attrs, a)
}