Skip to content

Commit a5cb6b5

Browse files
committed
keep original behavior and make exception accessible via flag
1 parent c174b80 commit a5cb6b5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/_load.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ def _load_instrumentors(distro):
7171
continue
7272

7373
try:
74-
distro.load_instrumentor(entry_point)
74+
distro.load_instrumentor(
75+
entry_point, raise_exception_on_conflict=True
76+
)
7577
_logger.debug("Instrumented %s", entry_point.name)
7678
except DependencyConflictError as exc:
7779
_logger.debug(

opentelemetry-instrumentation/src/opentelemetry/instrumentation/instrumentor.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,16 @@ def instrument(self, **kwargs: Any):
105105

106106
# check if instrumentor has any missing or conflicting dependencies
107107
skip_dep_check = kwargs.pop("skip_dep_check", False)
108+
raise_exception_on_conflict = kwargs.pop(
109+
"raise_exception_on_conflict", False
110+
)
108111
if not skip_dep_check:
109112
conflict = self._check_dependency_conflicts()
110113
if conflict:
111114
_LOG.error(conflict)
112-
raise DependencyConflictError(conflict)
115+
if raise_exception_on_conflict:
116+
raise DependencyConflictError(conflict)
117+
return None
113118

114119
# initialize semantic conventions opt-in if needed
115120
_OpenTelemetrySemanticConventionStability._initialize()

0 commit comments

Comments
 (0)