Skip to content

Commit

Permalink
Restore exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
WqyJh committed Apr 18, 2024
1 parent f835945 commit cb919f6
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions opentelemetry-api/src/opentelemetry/context/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,18 @@ def _load_runtime_context() -> typing.Optional[_RuntimeContext]:
OTEL_PYTHON_CONTEXT, default_context
) # type: str

return next( # type: ignore
iter( # type: ignore
entry_points( # type: ignore
group="opentelemetry_context",
name=configured_context,
try:
return next( # type: ignore
iter( # type: ignore
entry_points( # type: ignore
group="opentelemetry_context",
name=configured_context,
)
)
)
).load()()
).load()()
except Exception: # pylint: disable=broad-except
logger.exception("Failed to load context: %s", configured_context)
return None


_RUNTIME_CONTEXT = _load_runtime_context()
Expand Down

0 comments on commit cb919f6

Please sign in to comment.