Decouple the responsibilities of the environment variable propagation carrier#4961
Decouple the responsibilities of the environment variable propagation carrier#4961pellared wants to merge 15 commits intoopen-telemetry:mainfrom
Conversation
|
CC @open-telemetry/semconv-cicd-approvers |
|
This is consistent with how C++ implemented it: open-telemetry/opentelemetry-cpp#3834 (comment)
|
Exactly! The same applies for:
I added the C++ implementation for reference. In my opinion, the current Swift implementation is not good. My intuition tells me that this should be done by implementing |
Co-authored-by: Reiley Yang <reyang@microsoft.com>
It's a long standing, prior art implementation. As a user of the OTel libraries, I've preferred experiences with propagator wrappers because I know what I'm getting. Whereas, with the carrier, it's less obvious (as in I have to dig) to figure out what is available. Does this guidance now mean that the B3 propagator, as an example, will have to have normalization logic added in order to convert |
Can you please be more specific and provide code examples that demonstrate how using carrier is less obvious (and what does it mean). It rather seems to opposite as e.g. it would requiring creating a new propagator each time you want to spawn a new process. This seems also against the idea of defining/setting propagator once and using it with different carriers. How would one use the same propagator for HTTP instrumentation where HTTP headers are used as propagation carrier and something that spawns a new CLI command needs to propagate the context via env vars? How would making a propagation wrapper would make this example better: https://go.dev/play/p/LV7REU1UXmJ ?
If it does then I made some mistakes in this PR. Is there any part that says that? The B3 propagator should have nothing to do with converting |
In one of the early working prototypes I had, the propagator had the mapping directly defined similar to how some of the other propagators did it. Because it was clearly defined in the code, it was quickly readable. With carrier, you have to dive deeper to figure out what, when normalized, will be respected by the w/e propagator is being used. AFAICT, the behavior being described here seems to require that the propagators have to do some type of remapping once the values are carried inside the code. Sure, everything will get carried, but as far as knowing what gets carried vs what gets propagated is harder in my mind to understand. Maybe I'm missing something, and maybe this shouldn't be specifically addressed in this pull request. |
The propagators are already responsible for encoding the values that are encoded in the propagation header values. These are already handled by the propagator implementation. For instance here is an implementation of The env var carrier normalizes the You may also be interested in this thread: #4944 (comment) EDIT: I created a PR for Swift to follow the same pattern as in other languages open-telemetry/opentelemetry-swift-core#47 |
Follows #4944
Per #4944 (comment)
Per #4961 (comment)
Changes
Decouple the responsibilities of the environment variable propagation carrier from concerns that are: