Skip to content

Commit

Permalink
Fix mypy check by make _load_runtime_context failfast
Browse files Browse the repository at this point in the history
  • Loading branch information
WqyJh committed Apr 24, 2024
1 parent 1f6f90e commit 703ad62
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions opentelemetry-api/src/opentelemetry/context/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,14 @@ def _load_runtime_context() -> typing.Optional[_RuntimeContext]:
OTEL_PYTHON_CONTEXT, default_context
) # type: str

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

_RUNTIME_CONTEXT = _load_runtime_context()

Expand Down

0 comments on commit 703ad62

Please sign in to comment.