Skip to content

feat(baggage): fix DatadogPropagator::fields#217

Merged
iunanua merged 3 commits into
rachel.yang/w3c-baggagefrom
igor/rachel.yang/w3c-baggage
May 12, 2026
Merged

feat(baggage): fix DatadogPropagator::fields#217
iunanua merged 3 commits into
rachel.yang/w3c-baggagefrom
igor/rachel.yang/w3c-baggage

Conversation

@iunanua

@iunanua iunanua commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

  • change DatadogCompositePropagator to obtain keys from injectors according to Otel spec.
  • remove the not needed DatadogPropagator::fields property

@iunanua iunanua marked this pull request as ready for review May 4, 2026 07:28
@iunanua iunanua requested a review from a team as a code owner May 4, 2026 07:28

@paullegranddc paullegranddc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is what's described in the spec?
Because from what I see, thje Keys section is under the TextMap Extract title.

The doc specific to B3 headers mentions

Fields MUST return the header names that correspond to the configured format, i.e., the headers used for the inject operation

but it seems very specific to B3 🤔

fn fields(&self) -> opentelemetry::propagation::text_map_propagator::FieldIter<'_> {
let fields: &[String] = if self.cfg.enabled() {
&self.fields
self.inner.keys()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is soo confusing... is it keys or fields? They are not always the same.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed.
I'm going to rename the keys() as fields()

@iunanua

iunanua commented May 4, 2026

Copy link
Copy Markdown
Collaborator Author

Are you sure this is what's described in the spec? Because from what I see, thje Keys section is under the TextMap Extract title.

The doc specific to B3 headers mentions

Fields MUST return the header names that correspond to the configured format, i.e., the headers used for the inject operation

but it seems very specific to B3 🤔

There is some confusion about this:
Otel TextMapPropagator trait defines the fields() method. It returns an iter of fields used by [TextMapPropagator]
and spec says

Fields MUST return the header names that correspond to the configured format, i.e., the headers used for the inject operation.

But our DatadogCompositePropagator has the keys() method. It returned the header keys of the configured extractors which were ultimately used as values for the otel fields...

@bantonsson

Copy link
Copy Markdown
Collaborator

@paullegranddc With regards to what fields should return, the relevant part of the generic spec is here and it says:

The predefined propagation fields. If your carrier is reused, you should delete the fields here before calling Inject.

@iunanua iunanua merged commit ff4221f into rachel.yang/w3c-baggage May 12, 2026
25 checks passed
@iunanua iunanua deleted the igor/rachel.yang/w3c-baggage branch May 12, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants