jaegertracing / jaeger-client-python

🛑 This library is DEPRECATED!
https://jaegertracing.io/
Apache License 2.0
408 stars 155 forks source link

Make Tracer.close() threadsafe & not drop spans #293

Closed obataku closed 2 years ago

obataku commented 3 years ago

Signed-off-by: obataku 19821199+obataku@users.noreply.github.com

Which problem is this PR solving?

this PR avoids problematic direct Future.set_result/set_exception calls from the jaeger-client background tornado IO loop on Futures belonging to a wholly separate event loop as Futures are not threadsafe. it also stops Reporter.close() from dropping spans whose background _report_span_from_ioloop callbacks are still pending execution.

NOTE: this currently relies on Tornado 5+ & Python 3.7+ as it makes use of tornado.concurrent.Future being an alias for asyncio.Future and the existence of Future.get_loop, respectively; I'm investigating a way of keeping this backwards compatible