mirror of
https://github.com/restic/restic.git
synced 2025-10-29 12:30:03 +00:00
Update vendored library cloud.google.com/go
This commit is contained in:
25
vendor/cloud.google.com/go/spanner/go18.go
generated
vendored
25
vendor/cloud.google.com/go/spanner/go18.go
generated
vendored
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user