-
Notifications
You must be signed in to change notification settings - Fork 822
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe your environment
OS: (e.g, Ubuntu) Any
Python version: (e.g., Python 3.9.10) Any
SDK version: (e.g., 1.25.0) 1.40.0
API version: (e.g., 1.25.0) Any version lower than 1.40.0, for example 1.33.1
What happened?
PR #4867 introduced hard imports of symbols only available in API 1.40.0+.
This breaks zero-code instrumentation when:
- User application pins
opentelemetry-apito an older version lower than 1.40.0 - SDK(1.40.0) + instrumentation(0.61) packages are injected at runtime via
PYTHONPATH
Steps to Reproduce
# 1. Simulate user application with older API
pip install opentelemetry-api==1.39.0
# 2. Inject SDK 1.40.0 via PYTHONPATH (simulating runtime injection)
pip install --target /opt/otel opentelemetry-sdk==1.40.0
export PYTHONPATH="/opt/otel:$PYTHONPATH"
# 3. Launch with zero-code instrumentation
opentelemetry-instrument python myapp.py
# → ImportError: cannot import name '...' from 'opentelemetry.api...'
Expected Result
Use defensive imports (try/except) for symbols introduced in newer API versions, and fall back gracefully.
Actual Result
ImportError on startup. Zero-code instrumentation completely fails with no actionable guidance.
Additional context
No response
Would you like to implement a fix?
None
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working