census-instrumentation / opencensus-go

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

Tracestate header not generated or mutated #1271

Open dschanoeh opened 2 years ago

dschanoeh commented 2 years ago

What version of OpenCensus are you using?

v0.22.3

What version of Go are you using?

1.16

What did you do?

Configured opencensus-go with W3C tracecontext propagation and created a new span with StartSpanWithRemoteParent().

What did you expect to see?

A traceparent header should be generated (or mutated if one already existed) A tracestate header should be generated (or mutated if one already existed)

What did you see instead?

A traceparent header is generated, containing the trace ID and a new span ID, but the tracestate header is just passed through 1:1 or not generated at all if it wasn't part of the incoming request.

Additional context

While this doesn't go against the W3C spec, a tracestate should be generated/mutated. Also, I don't see the functionality in the library to manually do this since the whole generation/mutation process is somewhat hidden to the caller (but maybe I'm missing something here). If that's possible already, a pointer to how this is supposed to be used would be greatly appreciated.