-
Notifications
You must be signed in to change notification settings - Fork 773
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
Add Global Propagators API #581
Comments
Here's the proposal: In SDK, (Logging does not rely on SDK.cs, so we "touch" SDK.cs from LoggingProvider, to trigger above initialization) In each instrumentations, |
@cijothomas Should we add a builder method as a convenience like... public TracerProviderBuilder SetPropagator(Propagator propagator)
{
Propagators.Default = propagator ?? throw new ArgumentNullException(nameof(propagator));
} But that also begs the question: What if the user wants to have multiple If we want to support multiple we could move from static to a field on TracerProviderSdk and then give instrumentation a way to grab it from the TracerProviderSdk they are registered for. I feel like we could make that work, and it would be useful. If instrumentation & exporters could resolve the TracerProvider they are registered for we could use that for other things like retrieving Resource, which would eliminate the need to store it on each activity. |
If one wants to have separate propagator per TracerProviderSdk, then they can achieve it, as every instrumentation allows override. (About activity avoiding the storage of Resource, yes, i am still thinking of the best approach. #1397) |
I figured you'd say that 😄 Agree they can make it work. But I also feel like we could provide a nice and consistent API. Some stuff is static, some stuff is a builder, some stuff is carried around on activity. Code smells right? Everything working off the builder/TracerProvider would be nice, and I don't think that difficult to achieve. The goal being: One way to configure propagation regardless of how many TracerProviders you want to use 🚀 And it would be the same API used for propagation & resources 🚀🚀 |
Ok, so there will be 3 places to set Propagator.
Or are you saying we just need 1,2 and eliminate the instrumentation specific one.? |
I'm thinking we should only have 2 & 3. I know the spec says "Global" but that doesn't really make sense for our (current) API/SDK. Our "global" is really scoped to a TracerProvider, at least in my mind. Each TracerProvider should have a Resource and a Propagator. Any instrumentation, processor, exporter, etc., should be able to resolve its parent TracerProvider and it's "global" state. Since everything is constructed through the builder, should be easy to pass TracerProvider as a "parent" ref? Something like that. |
PR #1428 makes the following: Open to make the link PR doe 2 as well, but it doesn't eliminate the need for 1 as its a spec requirement. |
PR 1428 added Propagators.GetDefault in API. (to be consumed by instrumentations) To be discussed and finalized: |
Propagators were moved from Tracer into a separate area so they can be consumed by meters too.
https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/context/api-propagators.md#global-propagators
The text was updated successfully, but these errors were encountered: