Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#3423](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3423))
- `opentelemetry-instrumentation-asyncio` Fix duplicate instrumentation
([#3383](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/3383))

- `opentelemetry-instrumentation-botocore` Add GenAI instrumentation for additional Bedrock models for InvokeModel API
([#3419](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3419))
- `opentelemetry-instrumentation` don't print duplicated conflict log error message
([#3432](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3432))

## Version 1.32.0/0.53b0 (2025-04-10)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ def instrument(self, **kwargs: Any):
if not skip_dep_check:
conflict = self._check_dependency_conflicts()
if conflict:
_LOG.error(conflict)
if raise_exception_on_conflict:
raise DependencyConflictError(conflict)
_LOG.error(conflict)
return None

# initialize semantic conventions opt-in if needed
Expand Down
21 changes: 20 additions & 1 deletion opentelemetry-instrumentation/tests/test_instrumentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ def test_protect(self):
def test_singleton(self):
self.assertIs(self.Instrumentor(), self.Instrumentor())

@patch("opentelemetry.instrumentation.instrumentor._LOG")
@patch(
"opentelemetry.instrumentation.instrumentor.BaseInstrumentor._check_dependency_conflicts"
)
def test_instrument_missing_dependency_raise(
self, mock__check_dependency_conflicts
self, mock__check_dependency_conflicts, mock_logger
):
instrumentor = self.Instrumentor()

Expand All @@ -71,3 +72,21 @@ def test_instrument_missing_dependency_raise(
instrumentor.instrument,
raise_exception_on_conflict=True,
)
mock_logger.error.assert_not_called()

@patch("opentelemetry.instrumentation.instrumentor._LOG")
@patch(
"opentelemetry.instrumentation.instrumentor.BaseInstrumentor._check_dependency_conflicts"
)
def test_instrument_missing_dependency_log_error(
self, mock__check_dependency_conflicts, mock_logger
):
instrumentor = self.Instrumentor()
conflict = DependencyConflict(
"missing", "missing"
)
mock__check_dependency_conflicts.return_value = conflict
self.assertIsNone(
instrumentor.instrument(raise_exception_on_conflict=False)
)
mock_logger.error.assert_any_call(conflict)
Loading