Skip to content

FastAPI instrumentor import failure #1182

@talboren

Description

@talboren

Describe your environment
Python3.7
FastAPI
Opentelemtry v0.32b0

Steps to reproduce
When importing FastAPIInstrumentor
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
The exception below is being thrown

What is the actual behavior?
Exception is being thrown when importing FastAPI Instrumentor

Exception

Traceback (most recent call last):
  File "/home/anecdotes/.local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/home/anecdotes/.local/lib/python3.7/site-packages/uvicorn/workers.py", line 66, in init_process
    super(UvicornWorker, self).init_process()
  File "/home/anecdotes/.local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
    self.load_wsgi()
  File "/home/anecdotes/.local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/home/anecdotes/.local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/home/anecdotes/.local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
    return self.load_wsgiapp()
  File "/home/anecdotes/.local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/home/anecdotes/.local/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
    mod = importlib.import_module(module)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/app/main.py", line 20, in <module>
    from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
  File "/home/anecdotes/.local/lib/python3.7/site-packages/opentelemetry/instrumentation/fastapi/__init__.py", line 138, in <module>
    from opentelemetry.instrumentation.asgi import OpenTelemetryMiddleware
  File "/home/anecdotes/.local/lib/python3.7/site-packages/opentelemetry/instrumentation/asgi/__init__.py", line 183, in <module>
    class ASGIGetter(Getter[dict]):
TypeError: 'ABCMeta' object is not subscriptable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions