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

Explore Custom Sampler injection via Entry Points for Manual Instrumentation #3032

Open
jeremydvoss opened this issue Nov 10, 2022 · 1 comment

Comments

@jeremydvoss
Copy link
Contributor

In order to enable custom samplers for auto-instrumentation, I needed to use entry points in conjunction with environment variables -- same as exporters, distros, configurators, and other components. Since OT Sampling already uses environment variables (but not entry points) to enable users to specify a built-in sampler, even via manual instrumentation, I initially chose to expand that logic in the trace.sampling module to include custom samplers from entry points. This was unlike existing entry point usage that happens at the higher_configuration level. This enabled custom samplers for auto- and manual instrumentation:
Initial feature PR: #2972

However, because imported custom samplers may come from modules that depend on trace or trace.sampling, this can easily create a circular dependency upon loading the entry point. Note that the circular dependency did not exist within any package, but rather between them:
Bug: #3013

Seeing that the source of this issue was the fact that the entry point needed to be loaded in trace.sampling instead of in _configuration like all others, I fixed the circular dependency issue, but only by once again disabling entry point injection of custom samplers for manual instrumentation:
Fix PR: #3026

With this PR (still open on this issue's creation), manual instrumentation will be as it initially was. Users can specify built in samplers via environment variables or use custom samplings by passing them in as an argument of the TracerProvider. However, auto-instrumentation users will also be able to specify Custom Samplers via entry point injection.

This ticket is to explore if it is possible to enable entry point injection of custom samplers (and other components) for manual instrumentation as well.

@jeremydvoss
Copy link
Contributor Author

I'll try to add a small example so people can easily reproduce the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant