-
Notifications
You must be signed in to change notification settings - Fork 543
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
Load instrumentors via Distro #480
Conversation
d351f91
to
b11ed56
Compare
Ported PR open-telemetry/opentelemetry-python#1751 from core. |
open-telemetry/opentelemetry-python#1751 (comment)
@ocelotl answering your Q ^ from the core PR. My specific use case is that I want to add additional functionality to some instrumentations with the help of hooks in the splunk-otel-python distribution. For example, I might want to override the logic to compute span names or want to add additional Splunk specific tags to spans. How do I do that today so that users running their apps with This feature will allow the Splunk distro to pass splunk specific kwargs to instrumentations when using the opentelemetry-instrument command. Sure, the distro can inject env vars for every single kwarg it wants to pass to every single instrumentation and we could update all instrumentations to support passing customization options via both kwargs and env vars including for python objects such as callbacks. It is technically doable but it is far more complicated and touches so many more packages, not to mention how ugly it'd make the distro code. This feature gives distros a clean and obvious way to override instrumentation initialization in a single place. |
This commit makes the following changes: - Introduces a new `load_instrumentor(EntryPoint) -> None:` with a default implementation method to the `BaseDistro` class. - The default implementation loads the insrumentor from the provided entry point and calls applies it without any arguments. (same as before) - sitecustomize now calls Distro's `load_instrumentor` method to load and activate an instrumentor instead of doing it directly. - Added a new `DefaultDistro` implementation which is used if not distro is found by entry points.
b11ed56
to
c86dae6
Compare
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.
👍
Description
This feature allows distros to customize instrumentation initialization when using automatically instrumenting with the
opentelemetry-instrument
command.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist: