python-django
python-django copied to clipboard
Lazily initialize tracer for Jaeger/1.10 compatibility
When running The Jaeger Python Client with this library, the initialization step hangs indefinitely with Django 1.10.
@mikebryant if you take your example OpenTracing/Jaeger Django project and upgrade Django to >=1.10 and try running, the server will fail to start.
I believe this comes down to the way in which Django changed the initialization of Middleware. In versions prior to Django 1.10, the middleware wouldnt be initialized until the first request. In Django 1.10+, the middleware is initialized on start. Initializing the Jaeger tracer before the first request causes the Jaeger client to deadlock -- check out Jaeger Issue 31 and Jaeger Issue 60.
This change simply forces the initialization to happen once on the first request, thus avoiding the above behavior.
@mikebryant ^^
Is there anything preventing this from being accepted, @mikebryant? It doesn't seem to introduce any long term overhead for apps or tracers and is necessary for the jaeger client to work in django.
ugh, I'm really sorry. I've been overloaded with other stuff and missed this.
Thanks for pinging me about this!
Ping :)
@carlosalberto, @benjigoldberg if it's any help I was able to get this working against master w/ these changes: https://github.com/rmfitzpatrick/python-django/commit/301045b6a27dcd0ecb87f0a7f743ccbe2f5ec207.
Hi folks,
It would be great to see rmfitzpatrick@301045b cherry-picked into master
.
Thank you for the effort, @benjigoldberg and @rmfitzpatrick!
Hi guys, any update 💃