-
Notifications
You must be signed in to change notification settings - Fork 896
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
Instrumentation library info and Resources are not available to Samplers #1588
Comments
Sorry I did not react on #1658 (comment) @bogdandrutu (and @iNikem)
For the first point, I still don't know now if we want to support having a sampler attached to multiple Tracers/TracerProviders or if we want to go the route of the SamplerProviderFactory. Also, since we probably want to keep the times we change the stable sampler interface at a minimum, I don't think we should split the PR here, but decide now whether we ever want resources to be available to the sampler, and if so, in what way. There is also a very similar issue open for how to pass resources to exporters here (#508). In summary, it currently feels like we have too many open questions in that area to proceed before we solve them in a way that gives us a consistent result. I see this cluster of issues:
|
I agree that there are a lot of open questions about Resources. But I also agree with Bogdan that making |
Here's a sampler that needs Resource, for now passing in as a constructor but "keep in sync with SDK instance" is an unfortunate aspect. |
@Oberon00 I want to have |
@iNikem I have no problem with someone else doing the PR, so please go ahead 😃👍 I'm a bit worried about not including resources though. This will probably mean that we will never get around to it (and would need to make not-easily-compatible changes twice if we did). |
Just wondering if there's anything innately complicated about Resource that isn't for InstrumentationLibrary? If there isn't really any difference in complexity, given that the update will require backwards compatibility shims / default methods, isn't there benefit to doing them both at the same time to reduce API churn? For use case, the X-Ray sampler requires the resource to allow sampling rules based on service type or ARN. I currently use this tedious pattern which is already basically "deprecated on launch". |
No, but the last PR was declined because people wanted to have a more complicated solution which the PR author (me) was not really interested in, so it got nowhere, see the linked #1658. |
My only objection to reopening 1658 instead of 1850 is the fear that it will be dragged for a long time again. I see a clear benefit in handling InstrumentationLibrary and Resource separately. |
During Maintainers meeting on 20-09-2021 @jmacd expressed his opinion that we should move to configuration-time decisions of configuring SDK and/or Several attendees, myself including, agreed that this is a reasonable idea. It was thus decided to revert introducing |
Doesn't this disallow tweaking sampling rate based on resource information since the decisions would already have been completed? Cranking up the sampling rate based on resource without restarting a server is very important functionality when debugging specific services in a system and controlling sampling with a centralized config. Though I understand that we "get back to the drawing board to choose between two approaches" so I'm guessing that means this isn't actually a done thing but just an idea so should be OK. |
But resources are immutable? How decisions can be changed based on immutable resources? |
If you have a sampling config such as
but service1 starts having a problem, you can usually redeploy the file and watch it to reconfigure the sampler without restarting your app
Resource indeed didn't change, but sampling rate did. |
@anuraaga that just requires sampler to support dynamic config (as jaeger samplers do), not to reinitialize sampler with a different resource. |
@yurishkuro Right the sampler doesn't need to be reinitialized - but it needs access to the Resource which is what this issue is titled.
The main point is that this isn't true for dynamic updates of sampling rate. |
It CAN have access to resource upon initialization, just not at ShouldSample() calls. Dynamic updates of sampling rate do not change anything in the Resource. |
Is there any progress on this issue? The span name argument is not quite useful if the instrumentation library cannot be determined. |
I like the idea that Samplers should be configured on a per-Tracer basis. This won’t require changes in OpenTelemetry API. It’s generally better to keep the interface of Sampler minimal. It’s also more flexible to provide information to user code as early as this piece of information becomes available than delaying it to the time to creating Spans. |
Looks like the API needs to be extended to either configure a new sampler on an existing |
I need this feature as well in order to reduce the verbosity of noisy instrumentation libraries in a general and dynamic manner. |
No, |
Hey, guys. I don't quite understand what's being said here😳Is there a way to exclude span data now if we don't use
Agreed, the span name may be duplicated between different instrumention library. |
My old OTEP was about supporting per-Tracer samplers. So those interested might want to look at it for a starting point: open-telemetry/oteps#186 I've flip flopped on the usefulness of this approach so haven't tried carrying it forward. |
May I know the approach you eventually take to resolve this issue? I'm happy to raise another OTEP for this. But I'd like to limit the scope to |
@sherwoodwang I think sampler should just take the instrumentation library as an argument. |
For my project, I would be satisfied with both approaches, either adding the dispatching logic to tracer providers, or adding arguments to samplers. According to the discussions above, Resource and InstrumentationScope need to be added at the same time in the same way. I'll try to create a OTEP. I haven't participated in the specification in the past. But I'll try. |
We at AWS also would really benefit from this feature, specifically so that we can pass in the Resource object when a Sampler is created for it to use in Rule matching logic when making sampling decisions. For example, taking @sherwoodwang please tag me if you make any PRs to this end! |
Any news about this? We sometimes want to configure the sampling according to the source name, we do want this feature |
ShouldSample receives as input all the known information about the Span to be created, see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.1.0/specification/trace/sdk.md#shouldsample, except the instrumentation library info and the Resources.
Suppressing unwanted spans depending on the instrumentation library name was one of the original motivations of introducing it in the first place, see https://github.com/open-telemetry/oteps/blob/main/text/0016-named-tracers.md#solution
Adding a backwards-compatible overload of ShouldSample that accepts these additional arguments (or an object with these additional properties) and providing a default implementation that forwards to the currently specified implementation should be possible at least in C++, Java, Python.
The text was updated successfully, but these errors were encountered: