Include trace flags in spans exported by the OTLPSpanExporter
Is your feature request related to a problem?
The opentelemetry protocol specifies that a Span can have a flags bit field, where bits 0-7 are the "trace flags" as defined in W3C Trace Context specification. Bits 8 and 9 are used to identify if a span's parent is remote.
In the OpenTelemetry python exporter package, the OTLPSpanExporter only includes bits 8 and 9, it is not including bits 0-7 with the trace flags (see the _span_flags function).
Describe the solution you'd like
Update the OTLPSpanExporter to include the trace flags in each span's flags field.
Describe alternatives you've considered
Creating a custom OTLPSpanExporterWithTraceFlags exporter that inherits from OTLPSpanExporter was considered, but that would involve duplicating the internal trace_encoder module.
Additional Context
There appears to be little consistency in how the OTLP span flags field is populated in the different language implementations. Go does it like python and only includes bits 8-9 (remote parent bits). Rust only includes the trace flag bits. While java and php include both the remote parent bits and the trace flag bits. This issue is requesting that the python OTLPExporter implementation be update to behave like the java and php implementations and include the trace flags and remote parent bits in span flags.
Would you like to implement a fix?
None
@xrmx @DylanRussell , Can you assign this to me
Having worked on the issue of exporting is Remote span flags for the following SDKs: https://github.com/open-telemetry/opentelemetry-js/pull/5910 https://github.com/open-telemetry/opentelemetry-ruby/pull/1917 https://github.com/open-telemetry/opentelemetry-rust/pull/3153 https://github.com/open-telemetry/opentelemetry-erlang/pull/894
I udnerstand the requirement, and I know how java sdk has exported the entire set of the flags, not just the last 2 bits, Can you please assign this issue to me @xrmx @DylanRussell ?
I can close this in a day or two
@nikhilmantri0902 feel free to open a PR
@xrmx opened a PR, can you please review it. I have made the changes and added test cases. Also please assign the issue to me.