Skip to content

Include trace flags in spans exported by the OTLPSpanExporter #4666

@prdayton

Description

@prdayton

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions