open-telemetry / opentelemetry-python

OpenTelemetry Python API and SDK
https://opentelemetry.io
Apache License 2.0
1.76k stars 614 forks source link

OTEL_PYTHON_CONTEXT not working #3857

Open WqyJh opened 5 months ago

WqyJh commented 5 months ago

Environment

Steps to reproduce Set OTEL_PYTHON_CONTEXT=context.

What is the expected behavior? _RUNTIME_CONTEXT be initiated as an Context instance.

What is the actual behavior? _RUNTIME_CONTEXT failed to initialize.

Additional context

If OTEL_PYTHON_CONTEXT=contextvars_context, an ContextVarsRuntimeContext instance would be loaded, however, if OTEL_PYTHON_CONTEXT=context, an Context instance won't be loaded. This is caused by entry_points function, the return value contains only one EntryPoint named contextvars_context.

image

See https://github.com/open-telemetry/opentelemetry-python/pull/3763#issuecomment-2017476021