Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing asgiref dependency when installing fastapi instrumentation from 0.25b0 #764

Closed
AntoineDao opened this issue Oct 20, 2021 · 3 comments · Fixed by #765
Closed

Missing asgiref dependency when installing fastapi instrumentation from 0.25b0 #764

AntoineDao opened this issue Oct 20, 2021 · 3 comments · Fixed by #765
Labels
bug Something isn't working

Comments

@AntoineDao
Copy link

Describe your environment Describe any aspect of your environment relevant to the problem, including your Python version, platform, version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main.

Here is a review of my environment:

  • Python version: 3.7.12
  • OS: python:3.7 Docker image base
  • Python dependencies in the form of a requirements.txt file:
fastapi>=0.63.0
PyJWT==1.7.1
python-dotenv==0.11.0
uvicorn==0.6.1
async-exit-stack==1.0.1
async-generator==1.10
cryptography==2.9.2
starlette-context==0.3.1
cloudevents==1.2.0
aiohttp==3.7.4.post0
google-cloud-secret-manager==2.2.0
asgiref
opentelemetry-instrumentation-aiohttp-client
opentelemetry-instrumentation-botocore
opentelemetry-instrumentation-fastapi
opentelemetry-instrumentation-requests
opentelemetry-instrumentation-sqlalchemy
opentelemetry-exporter-gcp-trace==1.0.0
opentelemetry-propagator-gcp==1.0.0

Steps to reproduce
I use the Fastapi Instrumentation which depends on the opentelemetry-instrumentation-asgi package. I run into an import error when I try to import the Fastapi instrumentation package:

from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
  File "/usr/src/app/app/server/application.py", line 8, in <module>
    from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
  File "/usr/local/lib/python3.7/site-packages/opentelemetry/instrumentation/fastapi/__init__.py", line 22, in <module>
    from opentelemetry.instrumentation.asgi import OpenTelemetryMiddleware
  File "/usr/local/lib/python3.7/site-packages/opentelemetry/instrumentation/asgi/__init__.py", line 26, in <module>
    from asgiref.compatibility import guarantee_single_callable
ModuleNotFoundError: No module named 'asgiref'

What is the expected behavior?
Not an import error 😛

What is the actual behavior?
An import error 😭

Additional context
I am fairly certain the breaking change is introduced in 0.25.b0 version of the opentelemtry python contrib package. I tested this by setting fixed versions to my requirements.txt file and going back a version each time while rebuilding the docker container.

I tried looking into the diff between 0.24b0 and 0.25b0 releases but couldn't find anything that would indicate some dependency import issues...

@AntoineDao AntoineDao added the bug Something isn't working label Oct 20, 2021
@owais
Copy link
Contributor

owais commented Oct 20, 2021

@AntoineDao I've submitted a patch to fix this but your requirements file mentions asgiref as a dependency so the import error should never have happened. Did you add it after you faced the error?

@AntoineDao
Copy link
Author

Hi @owais, sorry I just noticed I submitted the wrong requirements.txt 🙃... The one I used did not have asgiref in it. I added it in to resolve the issue on my end.

@AntoineDao
Copy link
Author

Thanks for the quick resolution 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants