You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add if the trace was sampled to the ctxTags (#184)
* we now will not add the traceId / spanId to ctxtags if it is not sampled
* update to add sampled to the tags
* code review
* OT explicitly check value is true or false
* OT not add tag if unknown value
assert.NotNil(s.T, opentracing.SpanFromContext(ctx), "handlers must have the spancontext in their context, otherwise propagation will fail")
60
45
tags:=grpc_ctxtags.Extract(ctx)
61
46
assert.True(s.T, tags.Has(grpc_opentracing.TagTraceId), "tags must contain traceid")
62
-
assert.True(s.T, tags.Has(grpc_opentracing.TagSpanId), "tags must contain traceid")
47
+
assert.True(s.T, tags.Has(grpc_opentracing.TagSpanId), "tags must contain spanid")
48
+
assert.True(s.T, tags.Has(grpc_opentracing.TagSampled), "tags must contain sampled")
49
+
assert.Equal(s.T, tags.Values()[grpc_opentracing.TagSampled], "true", "sampled must be set to true")
63
50
returns.TestServiceServer.Ping(ctx, ping)
64
51
}
65
52
@@ -72,12 +59,19 @@ func (s *tracingAssertService) PingList(ping *pb_testproto.PingRequest, stream p
72
59
assert.NotNil(s.T, opentracing.SpanFromContext(stream.Context()), "handlers must have the spancontext in their context, otherwise propagation will fail")
73
60
tags:=grpc_ctxtags.Extract(stream.Context())
74
61
assert.True(s.T, tags.Has(grpc_opentracing.TagTraceId), "tags must contain traceid")
75
-
assert.True(s.T, tags.Has(grpc_opentracing.TagSpanId), "tags must contain traceid")
62
+
assert.True(s.T, tags.Has(grpc_opentracing.TagSpanId), "tags must contain spanid")
63
+
assert.True(s.T, tags.Has(grpc_opentracing.TagSampled), "tags must contain sampled")
64
+
assert.Equal(s.T, tags.Values()[grpc_opentracing.TagSampled], "true", "sampled must be set to true")
0 commit comments