open-telemetry / open-telemetry/opentelemetry-python-contrib
DeprecationWarning: Inheritance class _InstrumentedApplication from web.Application is discouraged in aiohttp-server instrumentation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
Describe your environment
OS: MacOS
Python version: Python 3.11.8
Package version: 0.48b0
What happened?
Getting a deprecation warning when activating aiohttp-server instrumentation target aiohttp 3.9.3:
DeprecationWarning: Inheritance class _InstrumentedApplication from web.Application is discouraged
Steps to Reproduce
Use auto-instrumentation for the aiohttp library after including opentelemetry-instrumentation-aiohttp.
Expected Result
No deprecation warning
Actual Result
Following stack trace (with warnings turned into errors from Pytest):
Traceback (most recent call last):
File "/Users/phillip/Library/Caches/pypoetry/virtualenvs/shipwell-common-python-zjZyLK7l-py3.11/lib/python3.11/site-packages/opentelemetry/instrumentation/auto_instrumentation/_load.py", line 87, in _load_instrumentors
distro.load_instrumentor(entry_point, skip_dep_check=True)
File "/Users/phillip/Library/Caches/pypoetry/virtualenvs/shipwell-common-python-zjZyLK7l-py3.11/lib/python3.11/site-packages/opentelemetry/instrumentation/distro.py", line 63, in load_instrumentor
instrumentor: BaseInstrumentor = entry_point.load()
^^^^^^^^^^^^^^^^^^
File "/Users/phillip/Library/Caches/pypoetry/virtualenvs/shipwell-common-python-zjZyLK7l-py3.11/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2496, in load
return self.resolve()
^^^^^^^^^^^^^^
File "/Users/phillip/Library/Caches/pypoetry/virtualenvs/shipwell-common-python-zjZyLK7l-py3.11/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2502, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/phillip/Library/Caches/pypoetry/virtualenvs/shipwell-common-python-zjZyLK7l-py3.11/lib/python3.11/site-packages/opentelemetry/instrumentation/aiohttp_server/__init__.py", line 242, in <module>
class _InstrumentedApplication(web.Application):
File "<frozen abc>", line 106, in __new__
File "/Users/phillip/Library/Caches/pypoetry/virtualenvs/shipwell-common-python-zjZyLK7l-py3.11/lib/python3.11/site-packages/aiohttp/web_app.py", line 161, in __init_subclass__
warnings.warn(
DeprecationWarning: Inheritance class _InstrumentedApplication from web.Application is discouraged
Additional context
It appears this ends up breaking all http instrumentation, should this be a bit of a softer error and only break this specific instrumentation? Meaning this re-raise:
Would you like to implement a fix?
None
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in opentelemetry-instrumentation-aiohttp-server/init.py around the _InstrumentedApplication class at line 242, then inspect auto_instrumentation/_load.py around lines 89-91. Reproduce with aiohttp 3.9.3 and warnings treated as errors; done means the deprecation warning no longer breaks the relevant instrumentation behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100