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

Auto instrumentation of FastAPI application not working on 1.26.0 #4111

Closed
emil-vdw opened this issue Aug 8, 2024 · 2 comments
Closed

Auto instrumentation of FastAPI application not working on 1.26.0 #4111

emil-vdw opened this issue Aug 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@emil-vdw
Copy link

emil-vdw commented Aug 8, 2024

Describe your environment

OS: Fedora 40
Python version: Python 3.11.9
SDK version: 1.26.0
API version: 1.26.0
FastAPI: 0.111.0

What happened?

Auto instrumentation of FastAPI, even on a single process, is not working on the latest release. When manually instrumenting the service, it appears to work.

Steps to Reproduce

  1. Check out the repo at the following branch: https://github.com/emil-vdw/otel-asgi-issue/tree/emil-vdw/otel-1.26.0-fastapi-broken
  2. run start.sh
  3. Open http://127.0.0.1:8000/ in a browser

Expected Result

Traces are printed to the console.

Actual Result

No traces are printed to the console.

Additional context

Manually instrumenting the service produces traces:

from fastapi import FastAPI
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor

app = FastAPI()


@app.get("/")
async def hello():
    return {"message": "Hello World"}


FastAPIInstrumentor.instrument_app(app)

Would you like to implement a fix?

None

@emdneto
Copy link
Member

emdneto commented Aug 8, 2024

Hi: thanks. When related to instrumentations libs, you should open the issue in https://github.com/open-telemetry/opentelemetry-python-contrib. This issue is already mapped and should be fixed in open-telemetry/opentelemetry-python-contrib#2783

@lzchen
Copy link
Contributor

lzchen commented Aug 8, 2024

Closing due to duplicate.

@lzchen lzchen closed this as completed Aug 8, 2024
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

No branches or pull requests

3 participants