-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Refactor propagators #467
Refactor propagators #467
Conversation
Fixes #457 too. |
|
||
// ExtractHTTP applies props.HTTPExtractors() to the passed context | ||
// and the supplier and returns the combined result context. | ||
func ExtractHTTP(ctx context.Context, props Propagators, supplier HTTPSupplier) context.Context { |
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.
There is a WIP on this topic that suggests the ExtractHTTP
and InjectHTTP
static methods here should be exposed composite extractor or injector, i.e., suggests that instead Propagators
should implement HTTPExtractor and HTTPInjector interfaces itself.
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.
Please replace these static methods with Propagator
methods.
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.
As discussed in the SIG, this will take a bit more work and it's OK to merge what we have here and do the rest in a future PR.
c09ae13
to
db28c16
Compare
They are in process of being dropped from the specification and we haven't be using them anywhere in the project. Can reintroduce them later.
The supplier is used only in HTTP propagators currently. It's not clear if it will be useful for binary propagators if they get to be specified at some point.
The biggest change here is that HTTP extractors return a new context with whatever information the propagator is able to retrieve from the supplier. Such interface does not hardcode any extractor's functionality (like it was before by explicitly returning a span context and correlation context) and makes it easy to chain multiple propagators. Injection part hasn't changed.
This interface (and its default implementation) is likely going to be the propagation API used the most. Single injectors, extractors or propagators are likely going to be used just as parameters to the Option functions that configure the Propagators implementation.
It's rather pointless - just create an empty Propagators instance.
db28c16
to
82d2a28
Compare
Fixes #457.