-
Notifications
You must be signed in to change notification settings - Fork 893
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 InstrumentationLibrary to Sampler.ShouldSample #1850
Conversation
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.
This change LGTM. I would suggest not rushing it into this week's release if possible, mostly since if this goes in, I don't see any reason we can't add Resource in the same way
It would be good to aim to make such changes in the same release to reduce churn especially when taking into account backwards compatibility.
I am afraid it will not be that easy with Resources, as demonstrated by discussions in #1658 |
@iNikem We are ready to roll, just add a CHANGELOG entry ;) |
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.
It just occurred to me that the complicated design that @bogdandrutu suggested on #1658 is only 50% due to Resources. The InstrumentationLibrary would already not be provided through a simple argument but instead we should have
Have a "SamplerProvider" with a "getSampler(InstrumentationLibrary).
So while I think that this PR is a step in the right direction, I see no reason not to add a Resource as well, and I prefer adding these at once.
EDIT: Just to clarify: I'm against the more complicated design suggested in the linked thread and think the simple "design" in this PR or my #1658 are perfectly adequate. I just think that there is no reason not to add Resources as well.
If you have an argument for why Resources cannot be passed to ShouldSample directly while InstrumentationLibrary can, please say so and I will gladly re-approve. |
@Oberon00 As you saw yourself in #1658, there was a lot pushback for passing |
Changelog updated |
I got similar pushback for InstrumentationLibrary. Maybe it's more of a question who is currently on vacation. InstrumentationLibrary is static information per Tracer too, whereas Resource is static per TracerProvider. |
I don't really want to block it. I brought up my arguments.
@Oberon00 Consider having a PR to add |
Merging - thanks @Oberon00 for unblocking this (and hopefully we can get the remaining portion this month!) |
…metry#1850)" This reverts commit f936f2e.
…1942) This reverts commit f936f2e. Co-authored-by: Bogdan Drutu <[email protected]>
…metry#1850)" (open-telemetry#1942) This reverts commit f936f2e. Co-authored-by: Bogdan Drutu <[email protected]>
Partially addresses #1588. Picks up part of the previous PR #1658
Changes
Add
InstrumentationLibrary
toSampler.ShouldSample
Alternatives
First,
InstrumentationLibrary
could be added as an optional, not required, argument toShouldSample
. This change may be easier to implement in backward compatible manner. But I don't think it will make a significant difference.Second, as was proposed for
Resource
in #1658, we may avoid passingInstrumentationLibrary
to eachShouldSample
call by associating it withSampler
. That would mean having a separateSampler
instance for everyInstrumentationLibrary
either by having those instances associated withTracer
or by lettingTracerProvider
to have a registry/lookup table betweenInstrumentationLibrary
andSampler
. Unfortunately, current state of the spec makes this solution unfeasible for the following reasons.SDK spec says (emphasis is mine):
But the more important obstacle is the possibility to update the configuration of the
TracerProvider
, including updating the sampler. In this case all already existingTracers
have to start using the newSampler
. This makes the option of associatingSampler
with theTracer
totally unfeasible. The option of havingSampler
registry inTracerProvider
would work but would requireTracer
to lookup itsSampler
each time it has to make sampling decision. This will lead to worse performance that passingInstrumentationLibrary
toSampler.ShouldSample
.