Don't trace when failing to create a cleint stream
diff --git a/stream.go b/stream.go
index 537d4b3..698d749 100644
--- a/stream.go
+++ b/stream.go
@@ -114,6 +114,10 @@
codec: cc.dopts.codec,
tracing: EnableTracing,
}
+ s, err := t.NewStream(ctx, callHdr)
+ if err != nil {
+ return nil, toRPCErr(err)
+ }
if cs.tracing {
cs.trInfo.tr = trace.New("grpc.Sent."+methodFamily(method), method)
cs.trInfo.firstLine.client = true
@@ -123,10 +127,6 @@
cs.trInfo.tr.LazyLog(&cs.trInfo.firstLine, false)
ctx = trace.NewContext(ctx, cs.trInfo.tr)
}
- s, err := t.NewStream(ctx, callHdr)
- if err != nil {
- return nil, toRPCErr(err)
- }
cs.t = t
cs.s = s
cs.p = &parser{s: s}