census-instrumentation / opencensus-go

A stats collection and distributed tracing framework
http://opencensus.io
Apache License 2.0
2.06k stars 327 forks source link

Span created on client stats handler is not accessible from client interceptor #1232

Open jcchavezs opened 4 years ago

jcchavezs commented 4 years ago

Is your feature request related to a problem? Please describe. In the GRPC client, I am trying to access the span created by the stats handler from inside the interceptor but it is currently not possible as the context does not carry the span (see https://github.com/census-instrumentation/opencensus-go/pull/1233/files#diff-0dcdbbb99cd65803fcdadcb28ded881cR182), more so if the client span is a child of a parent span, we can access only the parent span but not the client span created by the stats handler (see https://github.com/census-instrumentation/opencensus-go/pull/1233/files#diff-0dcdbbb99cd65803fcdadcb28ded881cR120)

This happens because the interceptor calls the invoker and then it is the invoker the one that calls the StatsHandler which actually creates the span.

Describe the solution you'd like I'd like this to be consistent with GRPC server where you can access the span in the context from the interceptor (see https://github.com/census-instrumentation/opencensus-go/pull/1233/files#diff-0dcdbbb99cd65803fcdadcb28ded881cR194)

Describe alternatives you've considered None.