Skip to content

Commit 4751ba7

Browse files
authored
feat: Logs exception when skipping a resource detector
Emulates auto-instrumentation log emitted when an instrumentor fails to load https://github.com/open-telemetry/opentelemetry-python-contrib/blob/v0.50b0/opentelemetry-instrumentation/src/opentelemetry/instrumentation/auto_instrumentation/_load.py#L128
1 parent 12edef9 commit 4751ba7

File tree

1 file changed

+5
-2
lines changed
  • opentelemetry-sdk/src/opentelemetry/sdk/resources

1 file changed

+5
-2
lines changed

opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,11 @@ def create(
214214
)
215215
).load()()
216216
)
217-
except:
218-
# TODO emit warning per failed detector?
217+
except Exception as exc: # pylint: disable=broad-exception-caught
218+
logger.exception(
219+
"Failed to load resource detector %s, skipping",
220+
entrypoint.name
221+
)
219222
continue
220223
resource = get_aggregated_resources(
221224
resource_detectors, _DEFAULT_RESOURCE

0 commit comments

Comments
 (0)