-
Notifications
You must be signed in to change notification settings - Fork 739
Add "instruments-any" feature: unblock multi-target instrumentations while fixing dependency conflict breakage. #3610
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
base: main
Are you sure you want to change the base?
Conversation
35ce3e6
to
3e75908
Compare
This PR's goal is to tackle a longstanding issue from the ground up. I want to make certain that all past stakeholders for the instrumentations I seek to help understand and are okay with it |
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.
I am not subject matter expert, but the idea perfectly makes sense to me and I like it.
Thanks for mentioning me on this. While I still maintain |
Seems like a sensible approach and I believe this would have resolved the fastapi-slim package issue. (minor) Maybe |
@gryevns good idea, I'll consider switching the naming convection |
Just starting reading here, but by partially reverting #3202, and not including #3612, doesn't this re-break kafka-python in the auto instrumentation case? Specifically because kafka-python doesn't have the instruments either functionality yet and only has the instruments functionality which would mean, kafka-python and kafka-python-ng which doesn't ever happen. |
Yes, we would want to change the kafka toml accordingly. |
opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py
Show resolved
Hide resolved
6cffaa5
to
7d327e5
Compare
opentelemetry-instrumentation/src/opentelemetry/instrumentation/dependencies.py
Outdated
Show resolved
Hide resolved
opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/_load.py
Show resolved
Hide resolved
7d2c4fd
to
ea304d5
Compare
This reverts commit 71fb9ee.
…n/dependencies.py Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
ea304d5
to
73eab06
Compare
Description
Fixes breaking change to autoinstrumentation dependency conflicts while supporting instrumentations that target multiple package, such as fastapi, psycopg2, and kafka-python. This is a partial revert of #3202 . It restores previous functionality of checking for dependency conflicts before loading instrumentors. However, it also provides a cleaner solution solving the problem at it's source. There is now a new
instruments-any
field in for instrumentorpackage.toml
s. Unlike theinstruments
field which lists requirements all of which need to be present for the instrumentation,instruments-any
provides requirements any of which need to be present. For instance, the following structure would indicate that the kafka-python instrumentation targets either kafka-python or kafka-python-ng:(The current status of the kafka-python instrumentation is that the toml only mentions kafka-python, but support for kafka-python-ng is added through the instrumentor object itself.)
For more complicated scenarios, see this example:
This would indicate that the instrumentation should only be loaded when you have the dependencies (util and common and (foo or bar))
In my next PR, I intend to add this feature to the kafka, fastapi, and psycopg2 tomls. This PR however, is focused on fixing the issue of autoinstrumentation loading instrumentations before dependency conflicts.
Fixes #3434
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Added new unit tests, restored those deleted in #3202 and retrofitted those added.
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.