-
Notifications
You must be signed in to change notification settings - Fork 327
Remove deprecated trace.StartSpanWithXXX convenience methods #540
Remove deprecated trace.StartSpanWithXXX convenience methods #540
Conversation
plugin/ocgrpc/grpc_test.go
Outdated
|
||
te := &traceExporter{} | ||
trace.RegisterExporter(te) | ||
var ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you revert these changes?
In Go, this style is discouraged. var grouping is mostly discouraged unless the variables need to be strictly grouped together for readability. var is entirely discouraged unless it is for the zero value.
plugin/ocgrpc/trace_common.go
Outdated
md, _ := metadata.FromIncomingContext(ctx) | ||
name := "Recv" + strings.Replace(rti.FullMethodName, "/", ".", -1) | ||
func (sh *serverTraceHandler) TagRPC(ctx context.Context, rti *stats.RPCTagInfo) context.Context { | ||
var ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
1988c69
to
a250d24
Compare
@@ -59,7 +59,7 @@ func main() { | |||
|
|||
// Set up a new server with the OpenCensus | |||
// stats handler to enable stats and tracing. | |||
s := grpc.NewServer(grpc.StatsHandler(ocgrpc.NewServerStatsHandler())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in the other PR
a250d24
to
9618dbf
Compare
@rakyll PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit.
plugin/ocgrpc/trace_common.go
Outdated
if s := md[traceContextKey]; len(s) > 0 { | ||
if parent, ok := propagation.FromBinary([]byte(s[0])); ok { | ||
ctx, _ = trace.StartSpanWithRemoteParent(ctx, name, parent, trace.StartOptions{}) | ||
return ctx | ||
span = trace.NewSpanWithRemoteParent(name, parent, trace.StartOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move ctx = trace.WithSpan(ctx, span)
after this line and return.
if s := md[traceContextKey]; len(s) > 0 {
if parent, ok := propagation.FromBinary([]byte(s[0])); ok {
span := trace.NewSpanWithRemoteParent(name, parent, trace.StartOptions{})
return trace.WithSpan(ctx, span)
}
}
ctx, _ = trace.StartSpan(ctx, name)
return
9618dbf
to
9b97f91
Compare
No description provided.