ddtrace/contrib/tornado/decorators.py
def _finish_span(future):
    """
    Finish the span if it's attached to the given ``Future`` object.
    This method is a Tornado callback used to close a decorated function
    executed as a coroutine or as a synchronous function in another thread.
    """
    span = getattr(future, FUTURE_SPAN_KEY, None)

    if span:
        if callable(getattr(future, 'exc_info', None)):
            # retrieve the exception from the coroutine object
            exc_info = future.exc_info()
            if exc_info:
                span.set_exc_info(*exc_info)
        elif callable(getattr(future, 'exception', None)):
            # retrieve the exception from the Future object
            # that is executed in a different Thread
            if future.exception():
                span.set_exc_info(*sys.exc_info())

        span.finish()

    Finish the span if it's attached to the given ``Future`` object.
    This method is a Tornado callback used to close a decorated function
    executed as a coroutine or as a synchronous function in another thread.
    
Finish the span if it's attached to the given ``Future`` object.
This method is a Tornado callback used to close a decorated function
executed as a coroutine or as a synchronous function in another thread.
Finish the span if it ' s attached to the given ` ` Future ` ` object . This method is a Tornado callback used to close a decorated function executed as a coroutine or as a synchronous function in another thread .
def _finish_span(future):
    span = getattr(future, FUTURE_SPAN_KEY, None)
    if span:
        if callable(getattr(future, 'exc_info', None)):
            exc_info = future.exc_info()
            if exc_info:
                span.set_exc_info(*exc_info)
        elif callable(getattr(future, 'exception', None)):
            if future.exception():
                span.set_exc_info(*sys.exc_info())
        span.finish()
def _finish_span ( future ) : span = getattr ( future , FUTURE_SPAN_KEY , None ) if span : if callable ( getattr ( future , 'exc_info' , None ) ) : exc_info = future . exc_info ( ) if exc_info : span . set_exc_info ( * exc_info ) elif callable ( getattr ( future , 'exception' , None ) ) : if future . exception ( ) : span . set_exc_info ( * sys . exc_info ( ) ) span . finish ( )
Finish the span if it's attached to the given ``Future`` object.
Finish the span if it ' s attached to the given ` ` Future ` ` object .
"""
    Finish the span if it's attached to the given ``Future`` object.
    This method is a Tornado callback used to close a decorated function
    executed as a coroutine or as a synchronous function in another thread.
    """ # retrieve the exception from the coroutine object # retrieve the exception from the Future object # that is executed in a different Thread
future