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

Clarify that Sampler can be shared among TracerProvider #1690

Open
carlosalberto opened this issue May 12, 2021 · 7 comments
Open

Clarify that Sampler can be shared among TracerProvider #1690

carlosalberto opened this issue May 12, 2021 · 7 comments
Labels
area:sampling Related to trace sampling area:sdk Related to the SDK spec:trace Related to the specification/trace directory

Comments

@carlosalberto
Copy link
Contributor

carlosalberto commented May 12, 2021

In #1658 it is discussed whether Sampler can be shared between different TracerProvider instances or not. In the Spec itself there's no mention of this, and we should definitely clarify this, whether this is allowed or not.

@carlosalberto carlosalberto added area:sampling Related to trace sampling spec:trace Related to the specification/trace directory labels May 12, 2021
@Oberon00
Copy link
Member

This also needs to be clarified for exporters and spanprocessors.

@arminru arminru added the area:sdk Related to the SDK label May 12, 2021
@yurishkuro
Copy link
Member

Isn't TracerProvider meant to be a singleton?

@iNikem
Copy link
Contributor

iNikem commented May 13, 2021

Isn't TracerProvider meant to be a singleton?

From the spec:

Notwithstanding any global TracerProvider, some applications may want to or have to use multiple TracerProvider instances, e.g. to have different configuration (like SpanProcessors) for each

@carlosalberto
Copy link
Contributor Author

cc @bogdandrutu

@reyang
Copy link
Member

reyang commented May 18, 2021

Discussed during the spec SIG meeting:

  1. Sampler/Processor/Exporter are all part of the SDK, the clarification on whether the same instance can be shared among multiple tracer providers is recommended/must-have should be the same.
  2. It might be too late to enforce this (e.g. by saying that samplers MUST be able to share among tracer providers), we might be able to add clarification and recommend that implementations CAN/SHOULD encourage the sharing?

@bogdandrutu need your input on this.

@bogdandrutu
Copy link
Member

If we don't allow Sampler to be shared we can do improvements like pre-calculate conditions on Resource. I personally believe that every implementation of the Sampler can have its own requirement, for example a Sampler that needs access to Resource can require to not be shared.

@bogdandrutu
Copy link
Member

Right now, because the usage of Resource is an edge case, I think an implementation that needs Resource right now, can take the Resource as argument in the ctor and have a limitation that can be assign to only one TracerProvider which is fine, because right now we don't say that Sampler MUST be able to be associated with multiple TracerProviders. I think that is the case for exporter and Processor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:sampling Related to trace sampling area:sdk Related to the SDK spec:trace Related to the specification/trace directory
Projects
None yet
Development

No branches or pull requests

7 participants