Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagation - Extract handles multiple values on carrier using same key #4295

Merged

Conversation

jamesmoessis
Copy link
Contributor

@jamesmoessis jamesmoessis commented Nov 18, 2024

Fixes #433

Discussed in 11/5/24 Spec SIG, and prototyped in Java and Go.

Changes

Adds GetAll method to Getter, allowing for the retrieval of multiple keys for the same value. For example, an HTTP request may have multiple baggage headers.

As written in the changes, the implementation of GetAll is strictly optional. This is for two reasons:

  1. Backwards compatibility with existing types/interfaces
  2. Carriers do not necessarily support returning multiple values for a single key

Links to Prototypes

This includes implementations of GetAll() in Java and Go, as well as using the method in the W3C Baggage Propagators (multiple baggage headers are allowed, spec reference).

  • Links to the prototypes (when adding or changing features)
  • CHANGELOG.md file updated for non-trivial changes

CHANGELOG.md Outdated Show resolved Hide resolved
specification/context/api-propagators.md Show resolved Hide resolved
Copy link
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

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

Couple of minor comments

specification/context/api-propagators.md Outdated Show resolved Hide resolved
specification/context/api-propagators.md Outdated Show resolved Hide resolved
specification/context/api-propagators.md Outdated Show resolved Hide resolved
Co-authored-by: Trask Stalnaker <[email protected]>
@pellared
Copy link
Member

pellared commented Nov 26, 2024

The Go prototype does not have benchmarks that would showcase that there is no considerable performance degradation in hot-path. Without the benchmarks the OTel Go maintainers are not able to guarantee that we OTel Go is going to support GetAll.

@jack-berg
Copy link
Member

The Go prototype does not have benchmarks that would showcase that there is no considerable performance degradation in hot-path. Without the benchmarks the OTel Go maintainers are not able to guarantee that we OTel Go is going to support GetAll.

Only propagators that have the possibility of values being contained in multiple headers would need to call this new method, and be concerned about the perf overhead. The only propagator I know that fits this is the w3c baggage propagator. And the perf hit (if any) seems to be essential complexity required by the w3c specification.

@pellared
Copy link
Member

pellared commented Nov 26, 2024

The only propagator I know that fits this is the w3c baggage propagator

W3C TraceContext as well (sic!):

Tracestate MAY be sent or received as multiple header fields.

And the perf hit (if any) seems to be essential complexity required by the w3c specification.

I mean a performance hit even in a scenario that everything is in one header. The performance hit we are worried about it related to Go how it handles type assertions. People may start to complain that in most common scenario (when 1 header) the performance is worse. See open-telemetry/opentelemetry-go#5973 (comment).

specification/context/api-propagators.md Outdated Show resolved Hide resolved
specification/context/api-propagators.md Outdated Show resolved Hide resolved
specification/context/api-propagators.md Outdated Show resolved Hide resolved
specification/context/api-propagators.md Outdated Show resolved Hide resolved
specification/context/api-propagators.md Outdated Show resolved Hide resolved
specification/context/api-propagators.md Outdated Show resolved Hide resolved
specification/context/api-propagators.md Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@jamesmoessis
Copy link
Contributor Author

jamesmoessis commented Nov 27, 2024

@pellared do you still have performance concern after you found no extra allocations? From your comment: open-telemetry/opentelemetry-go#5973 (comment)

I also think there's something to be said about the value of correctness outweighing potential minor performance concerns in this case.

@pellared
Copy link
Member

pellared commented Nov 27, 2024

@pellared do you still have performance concern after you found no extra allocations? From your comment: open-telemetry/opentelemetry-go#5973 (comment)

No. Approving. Thanks for your contribution 🏅

@jack-berg
Copy link
Member

Build is failing because of unrelated broken link, fixed here: #4314

@jack-berg jack-berg merged commit 3ce4873 into open-telemetry:main Nov 28, 2024
5 of 6 checks passed
@jamesmoessis jamesmoessis deleted the issue-433-extract-multi-value branch December 4, 2024 22:22
@carlosalberto carlosalberto mentioned this pull request Dec 6, 2024
carlosalberto added a commit that referenced this pull request Dec 13, 2024
December 2024 Release.

Mostly in-development additions, e.g.

*
#4183
*
#4295
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.

Propagation - Getter handling of multi-value headers/attributes
6 participants