open-telemetry / open-telemetry/opentelemetry-python-contrib
Provide a public Django middleware class
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
Is your feature request related to a problem?
We would to have control over what position django middleware gets placed in the chain. Currently the instrument() method inserts it at the head. In our case we would like to have exception tracking middleware (Rollbar) execute before tracing middleware.
Describe the solution you'd like
A public Django middleware class that can be configured in settings like so:
MIDDLEWARE = (
"middleware.ExceptionTrackingMiddleware",
"opentelemetry.instrumentation.django.DjangoMiddleware",
)
Describe alternatives you've considered
- Modifying middleware chain at runtime (this seems dangerous)
- Wrapping the private middleware class (also seems dangerous)
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 by tracing the instrument() method and the private Django middleware class, then compare their behavior with Django's MIDDLEWARE settings. The work is done when a public opentelemetry.instrumentation.django.DjangoMiddleware can be configured in the middleware chain and allows exception tracking middleware to run before tracing middleware.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100