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

Refactor propagators #467

Merged
merged 6 commits into from
Feb 14, 2020

Conversation

krnowak
Copy link
Member

@krnowak krnowak commented Feb 4, 2020

  • drop binary propagators
  • extract from propagators returns a new context with stuff
    • makes it easy to chain propagators
  • add propagators interface for chaining purposes
  • drop noop propagator

Fixes #457.

@krnowak
Copy link
Member Author

krnowak commented Feb 5, 2020

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 {
Copy link
Contributor

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.

open-telemetry/opentelemetry-specification#440

Copy link
Contributor

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.

Copy link
Contributor

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.

@krnowak krnowak force-pushed the krnowak/refactor-propagators branch 2 times, most recently from c09ae13 to db28c16 Compare February 11, 2020 13:24
jmacd and others added 6 commits February 12, 2020 20:10
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.
@rghetia rghetia added this to the Alpha v0.3 milestone Feb 13, 2020
@rghetia rghetia merged commit cf7a4d9 into open-telemetry:master Feb 14, 2020
@krnowak krnowak deleted the krnowak/refactor-propagators branch February 14, 2020 09:13
@rghetia rghetia mentioned this pull request Apr 9, 2020
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.

Document clearly that Supplier should operate on singly-valued keys
3 participants