Skip to content

Commit 1fd497e

Browse files
committed
Reduce severity & verbosity of instrumentation ImportError (#1115)
In auto-instrumentation context, it is expected that many of the supported target libraries will not be present. Hence, it does not make sense to flood logs with ImportErrors for this expected scenario.
1 parent 6537398 commit 1fd497e

File tree

2 files changed

+2
-2
lines changed
  • opentelemetry-instrumentation
    • src/opentelemetry/instrumentation/auto_instrumentation
    • tests/auto_instrumentation

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def _load_instrumentors(distro):
145145
# environment regarding python version, libc, etc... In this case it's better
146146
# to skip the single instrumentation rather than failing to load everything
147147
# so treat differently ImportError than the rest of exceptions
148-
_logger.exception(
148+
_logger.warning(
149149
"Importing of %s failed, skipping it", entry_point.name
150150
)
151151
continue

opentelemetry-instrumentation/tests/auto_instrumentation/test_load.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def test_load_instrumentors_import_error_does_not_stop_everything(
376376
]
377377
)
378378
self.assertEqual(distro_mock.load_instrumentor.call_count, 2)
379-
mock_logger.exception.assert_any_call(
379+
mock_logger.warning.assert_any_call(
380380
"Importing of %s failed, skipping it",
381381
ep_mock1.name,
382382
)

0 commit comments

Comments
 (0)