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

Initial composite/global Propagators update for OTEP 66. #440

Merged

Conversation

carlosalberto
Copy link
Contributor

This is an initial PR focusing on updating the Propagators API, and is meant to be get initial feedback, rather than getting merged right away. This is because related PRs are still not merged, which hopefully will change soon ;)

Overall:

  1. Composite Propagator concept: Even though in OTEP 66 this part is rather defined as a function taking a list of propagators, I think it makes sense to try to go with a composite Propagator concept.
  2. (Optional) Global Propagators. This has TraceContext/CorrelationContext as default global propagators, as some language implementations already do this.

specification/api-propagators.md Outdated Show resolved Hide resolved
specification/api-propagators.md Show resolved Hide resolved
specification/api-propagators.md Outdated Show resolved Hide resolved
specification/api-propagators.md Outdated Show resolved Hide resolved
@carlosalberto carlosalberto changed the title Initial Propagators update for OTEP 66. Initial composite/global Propagators update for OTEP 66. Feb 6, 2020
@carlosalberto carlosalberto added this to the Alpha v0.3 milestone Feb 6, 2020
specification/api-propagators.md Outdated Show resolved Hide resolved
specification/api-propagators.md Show resolved Hide resolved
specification/api-propagators.md Show resolved Hide resolved
specification/api-propagators.md Show resolved Hide resolved
specification/api-propagators.md Show resolved Hide resolved
specification/api-propagators.md Outdated Show resolved Hide resolved
@carlosalberto
Copy link
Contributor Author

@open-telemetry/specs-approvers please take a look at this one too ;)

specification/api-propagators.md Outdated Show resolved Hide resolved
specification/api-propagators.md Outdated Show resolved Hide resolved
specification/api-propagators.md Show resolved Hide resolved
specification/api-propagators.md Outdated Show resolved Hide resolved
specification/api-propagators.md Outdated Show resolved Hide resolved
specification/api-propagators.md Show resolved Hide resolved
in order to provide propagation even in the presence of no-op
OpenTelemetry implementations.

### Get Global Propagator
Copy link
Member

Choose a reason for hiding this comment

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

Do we want one global propagator (which may be composite), or do we want to add the propagator to the TracerProvider? Reason being that if you have multiple apps in a single runtime, each of which has its own tracer provider, you may want to use different propagation formats between apps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To me doing that sounds like an overkill for now - in practice, it looks like most people want a single place/component to do the entire injection/extraction.

We could add in the future an additional Propagator component to items such as TracerProvider and similar components (defaulting to null) in case users want to (optionally) override the global one, though 😃

Copy link
Member

Choose a reason for hiding this comment

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

How should we be calling the propagator?

  1. api.propagator.extract(...)
  2. tracer.extract(...)
  3. tracer_provider.extract(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You should be using 1) as this will be the 'default' thing - we might (but we might not) add 3) as a custom, override thing, in which case we could call that one as well.

The second option is due to be removed ;)

- The carrier that holds propagation fields.
- The instance of `Getter` invoked for each propagation key to get.

### Inject
Copy link
Member

Choose a reason for hiding this comment

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

Are we going to specify whether inject mutates the carrier or returns a new one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So currently the carrier that is passed is in turn passed to the Setter instance, which decides what to do with it along with the keys/values. In practice (99% of the time?) the carrier is indeed mutated, but not 'enforced'.

Copy link
Member

Choose a reason for hiding this comment

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

I was going to mark this as resolved, but for some reason don't have the button available like in the spec repo. Are permissions different here?

Copy link
Member

Choose a reason for hiding this comment

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

The Carrier APIs should be defined earlier in the doc. They are generally mutable by definition, although I could see how this could irk some FP-oriented people. It is rather difficult to make individual pieces immutable and composable, because the Carrier API fundamentally implies some transformation that is unknown to the propagator, like writing every key-value pair as HTTP header is a specific implementation of HTTPRequest.

Copy link
Member

Choose a reason for hiding this comment

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

(well, it's actually not THAT difficult, using some pipeline like propagators.map(_.stateAsMap(context)).flatMap(carrier.accumulate),
but it's rather inefficient).

Copy link
Member

Choose a reason for hiding this comment

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

@dyladan You need to be the author who opened the PR or have write permissions to the repo (i.e., be in spec-approvers) to resolve conversations.

@@ -62,7 +75,7 @@ Injects the value downstream. For example, as http headers.

Copy link
Member

Choose a reason for hiding this comment

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

I do not follow anything in the preceding Fields section. It seems very vague and random. And certainly does not belong specifically under the HTTP format.


- A `Context`.
- The carrier that holds propagation fields.
- The `Setter` invoked for each propagation key to add or remove.
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to separate carrier and setter?

@carlosalberto
Copy link
Contributor Author

Hey @yurishkuro thanks for the feedback. I've fixed the issues that are strictly related to this PR, and have created #453 to keep track the changes api-propagators.md overall needs (assigning it to myself).

Please re-review and let me know ;)

@yurishkuro yurishkuro merged commit 9938ab4 into open-telemetry:master Feb 10, 2020
SergeyKanzhelev pushed a commit to SergeyKanzhelev/opentelemetry-specification that referenced this pull request Feb 18, 2020
…try#440)

* Initial Propagators update for OTEP 66.

* Fix style.

* Initial feedback pass.

* Update specification/api-propagators.md

Co-Authored-By: Tyler Yahn <[email protected]>

* Update specification/api-propagators.md

Co-Authored-By: Tyler Yahn <[email protected]>

* Update specification/api-propagators.md

Co-Authored-By: Tyler Yahn <[email protected]>

* Update specification/api-propagators.md

Co-Authored-By: Tyler Yahn <[email protected]>

* Update specification/api-propagators.md

Co-Authored-By: Armin Ruech <[email protected]>

* Fix the mixed up getter/setter.

* Update specification/api-propagators.md

Co-Authored-By: Armin Ruech <[email protected]>

* Update specification/api-propagators.md

Co-Authored-By: Armin Ruech <[email protected]>

* Do not use RPC in api-propagators

* Use Format instead of format.

* Clarification on format in overview.md

Co-authored-by: Tyler Yahn <[email protected]>
Co-authored-by: Armin Ruech <[email protected]>
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.

7 participants