open-telemetry / open-telemetry/opentelemetry-python-contrib
Incompatible with CORSMiddleware app
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: any
Python version: any
Package version: 0.60b0
What happened?
https://github.com/fastapi/fastapi/discussions/8027
Steps to Reproduce
from typing import Optional
from starlette.middleware.cors import CORSMiddleware
from fastapi import FastAPI
fastapi_app = FastAPI()
app = CORSMiddleware(app=fastapi_app, allow_origins=['*'])
FastAPIInstrumentor.instrument_app(app)
Expected Result
Compatible with CORSMiddleware app.
Actual Result
Skipping FastAPI instrumentation due ... got CORSMiddleware.
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.
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 with the linked instrumentation/opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi/init.py around line 336 and reproduce the provided CORSMiddleware example. Trace FastAPIInstrumentor.instrument_app(app) and confirm that instrumentation no longer skips a CORSMiddleware-wrapped app.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python
- Domain
- backend, observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100