-
Notifications
You must be signed in to change notification settings - Fork 107
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
Update propagators with composite #273
Conversation
Codecov Report
@@ Coverage Diff @@
## main #273 +/- ##
==========================================
+ Coverage 36.49% 36.55% +0.05%
==========================================
Files 41 45 +4
Lines 3170 3187 +17
==========================================
+ Hits 1157 1165 +8
- Misses 2013 2022 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
620eb77
to
13ae5e0
Compare
CompositeInjector = otel_propagator_text_map_composite:create(List), | ||
CompositeExtractor = otel_propagator_text_map_composite:create(List), | ||
set_text_map_injector(CompositeInjector), | ||
set_text_map_extractor(CompositeExtractor); | ||
set_text_map_propagators(_) -> | ||
ok. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense here to allow a single entry to work? I.e. people could pass in their own composite (or single) callback there, so long as they respect the sort of {Mod::atom(), Args::list()}
format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yea, there was supposed to be a set_text_map_propagator
like there is set_text_map_injector/extractor
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tho maybe the plural forms should be removed. It is more important that simpler configuration works, which can do this without needing a public function. Would simplify the api, hopefully being less confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to only have the set_text_map_propagator
function.
as confusing as this is (as mentioned in side-channels, this feels really like OO ontology to please type checkers so it feels a bit foreign here), it sounds like the ability to be able to pass in arguments/state to the callback modules would be an interesting win there, considering the prior ones had no such support. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. Being able to inject/extract with arbitrary inputs is going to be helpful to have built into the main libs and there's still a nice balance with the default implementations.
Looks like there's a couple of tests to fix up, but otherwise 👍🏻
@ferd yea, the ability to include options may be useful. Right now there is no I suppose a Which is something I don't like the in the current spec, it adds |
@bryannaegele note the other PR also has all those things. But to be clear, you find the composite version to be better (clearer to the user)? I think we'll probably go with this but there are still the open question of how/whether to have an init for all propagators. Also the question of configuration. My idea is that we only support Related to configuration. What happens if propagators, injectors and extractors are all listed in the configuration? Do they get appended together or one override the other... |
This change makes propagators use a behaviour to define the inject and extract functions instead of being anonymous functions. The latest Otel spec is also matched by adding functions for getting all fields a propagator sets and allowing the overriding of the get/set/keys functions used by inject/extract.
Co-authored-by: Bryan Naegele <bryannaegele@users.noreply.github.com>
Co-authored-by: Fred Hebert <mononcqc@ferd.ca>
Since a new option to inject/extract was needed I've added 2 new functions `inject_from` and `extract_to` that take Contexts as the first argument. Otherwise there is a lot of overloading of types of arguments required.
instead of propagators always being a list that are run in order this PR requires a composite propagator be created if a multiple propagators are to be used.
4b66d42
to
b16ab6a
Compare
To simplify the interface from opentelemetry module the user must pass a single propagator, using a composite propagator if they need multiple. But the confiugration `text_map_propagators` remains and will create a composite propagator for the user.
fe76169
to
a6a1d9b
Compare
a6a1d9b
to
f772491
Compare
Ok, I think this is ready now. Note that in configuration right now you can only set the propagators (text map propagators to be specific) and not injectors/extractors individually. So the functions in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the functions in opentelemetry must be used if a user wants to use separate propagators for injecting and extracting.
Just making sure I understand - you're referring to otel_propagator_baggage:inject(Context, Carrier, CarrierSetFun, Options)
for instance, correct?
@bryannaegele no, users should not use propagator modules directly like that at all. In that comment I made I was referring just to globals, like: opentelemetry:set_text_map_injector({otel_propagator_b3multi, []}) Which makes the global text map injector be To not use the global propagators a user should do: otel_propagator_text_map:inject({otel_propagator_baggage, []}, [{<<"existing-header">>, <<"I exist">>}]), |
This is #269 but with a composite propagator instead of the only way to use propagators being a list.
I wanted to try this in part to see if it would lead me to a better/simpler API. I don't think it did. I open to this version if people see it as clearer, and it does stick closer to the spec https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/context/api-propagators.md
But I think I'd go with #269 -- curious to hear others thoughts?