-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Distro 1.6.7 Hotfix: Adjust to breaking change in opentelemetry-instrumentation #40463
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
Changes from 4 commits
a76f3d0
3f53a7f
c629553
39058a1
e036423
38f15f5
4e2b893
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ | |
| from opentelemetry._events import _set_event_logger_provider | ||
| from opentelemetry._logs import set_logger_provider | ||
| from opentelemetry.instrumentation.dependencies import ( | ||
| get_dist_dependency_conflicts, | ||
| DependencyConflictError, | ||
| ) | ||
| from opentelemetry.instrumentation.instrumentor import ( # type: ignore | ||
| BaseInstrumentor, | ||
|
|
@@ -211,25 +211,8 @@ def _setup_live_metrics(configurations): | |
| enable_live_metrics(**configurations) | ||
|
|
||
|
|
||
| class _EntryPointDistFinder: | ||
| @cached_property | ||
| def _mapping(self): | ||
| return {self._key_for(ep): dist for dist in distributions() for ep in dist.entry_points} | ||
|
|
||
| def dist_for(self, entry_point: EntryPoint): | ||
| dist = getattr(entry_point, "dist", None) | ||
| if dist: | ||
| return dist | ||
|
|
||
| return self._mapping.get(self._key_for(entry_point)) | ||
|
|
||
| @staticmethod | ||
| def _key_for(entry_point: EntryPoint): | ||
| return f"{entry_point.group}:{entry_point.name}:{entry_point.value}" | ||
|
|
||
|
|
||
| def _setup_instrumentations(configurations: Dict[str, ConfigurationValue]): | ||
| entry_point_finder = _EntryPointDistFinder() | ||
| # entry_point_finder = _EntryPointDistFinder() | ||
| # use pkg_resources for now until https://github.com/open-telemetry/opentelemetry-python/pull/3168 is merged | ||
| for entry_point in entry_points(group="opentelemetry_instrumentor"): | ||
| lib_name = entry_point.name | ||
|
|
@@ -239,20 +222,17 @@ def _setup_instrumentations(configurations: Dict[str, ConfigurationValue]): | |
| _logger.debug("Instrumentation skipped for library %s", entry_point.name) | ||
| continue | ||
| try: | ||
| # Check if dependent libraries/version are installed | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless I'm doing something wrong, the removal of this logic causes some messy log messages in our containers - e.g. tracebacks starting like: for all the libraries that aren't installed. Do we now have to explicitly disable these when calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dylwil3 please create a new issue (so it won't get overlooked). Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure - here it is: #40517 |
||
| entry_point_dist = entry_point_finder.dist_for(entry_point) # type: ignore | ||
| conflict = get_dist_dependency_conflicts(entry_point_dist) # type: ignore | ||
| if conflict: | ||
| _logger.debug( | ||
| "Skipping instrumentation %s: %s", | ||
| entry_point.name, | ||
| conflict, | ||
| ) | ||
| continue | ||
| # Load the instrumentor via entrypoint | ||
| instrumentor: BaseInstrumentor = entry_point.load() | ||
| # tell instrumentation to not run dep checks again as we already did it above | ||
|
jeremydvoss marked this conversation as resolved.
Outdated
|
||
| instrumentor().instrument(skip_dep_check=True) | ||
| instrumentor().instrument(raise_exception_on_conflict=True) | ||
| except DependencyConflictError as exc: | ||
| _logger.debug( | ||
| "Skipping instrumentation %s: %s", | ||
| entry_point.name, | ||
| exc.conflict, | ||
| ) | ||
| continue | ||
| except Exception as ex: # pylint: disable=broad-except | ||
| _logger.warning( | ||
| "Exception occurred when instrumenting: %s.", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.