Skip to content

Commit 69370ea

Browse files
committed
Restore exception handling
1 parent 5258ce3 commit 69370ea

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

opentelemetry-api/src/opentelemetry/context/__init__.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,18 @@ def _load_runtime_context() -> typing.Optional[_RuntimeContext]:
4141
OTEL_PYTHON_CONTEXT, default_context
4242
) # type: str
4343

44-
return next( # type: ignore
45-
iter( # type: ignore
46-
entry_points( # type: ignore
47-
group="opentelemetry_context",
48-
name=configured_context,
44+
try:
45+
return next( # type: ignore
46+
iter( # type: ignore
47+
entry_points( # type: ignore
48+
group="opentelemetry_context",
49+
name=configured_context,
50+
)
4951
)
50-
)
51-
).load()()
52+
).load()()
53+
except Exception: # pylint: disable=broad-except
54+
logger.exception("Failed to load context: %s", configured_context)
55+
return None
5256

5357

5458
_RUNTIME_CONTEXT = _load_runtime_context()

0 commit comments

Comments
 (0)