Repository: DataDog/dd-trace-py

Issue:
Opentracing active_span not working without starting new child span
### Which version of dd-trace-py are you using?
ddtrace[opentracing]==0.31.0

### Which version of the libraries are you using?
python 3.8
Django==2.2.6
channels==2.3.1
uvicorn==0.10.3
uvloop==0.14.0rc2
datadog==0.31.0

### How can we reproduce your problem?
When calling `opentracing.global_tracer().active_span` with automatic instrumentation of Django requests enabled. 

These are our Datadog related settings:
```python

    INSTALLED_APPS.append('ddtrace.contrib.django')

    from ddtrace import patch
    from ddtrace.filters import FilterRequestsOnUrl
    from ddtrace.opentracer import Tracer, set_global_tracer

    DATADOG_TRACE = {
        'DEFAULT_SERVICE': DATADOG_SERVICE_NAME,
        'AUTO_INSTRUMENT': True,
        'INSTRUMENT_DATABASE': False,
        'INSTRUMENT_CACHE': False,
        'INSTRUMENT_TEMPLATE': False,
        'AGENT_HOSTNAME': env('DD_AGENT_HOST'),
        'AGENT_PORT': env.int('DD_AGENT_PORT', default=8126),
    }

    set_global_tracer(
        Tracer(
            DATADOG_SERVICE_NAME,
            config={
                'settings': {
                    'FILTERS': [
                        FilterRequestsOnUrl(r'^http://.+/_health$'),
                    ],
                }
            }
        )
    )

    _DD_PATCHES = (
        'psycopg',
        'celery',
        'redis',
        'requests'
    )

    patch(**{module: True for module in _DD_PATCHES})
```
We have not done any special configs on Datadogs' context providers or Opentracing's scope managers. The debugger shows that these are `ContextVarContextManager` for Datadog and `ThreadLocalScopeManager` for Opentracing. All our code runs on ThreadpoolExecutors created automatically by django-channels and we have not written any asyncio code yet.

### What is the result that you get?
`active_span` returns None even though there is a DataDog span that is active for the Django request.

### What is result that you expected?
I would expect that that the current Datadog Span is available as an opentracing span without the need to create an additional child span.


Discussion:
Possibly related?? https://github.com/DataDog/dd-trace-py/pull/838

Resolving patch:
diff --git a/ddtrace/opentracer/tracer.py b/ddtrace/opentracer/tracer.py
--- a/ddtrace/opentracer/tracer.py
+++ b/ddtrace/opentracer/tracer.py
@@ -270,6 +270,25 @@ def start_span(self, operation_name=None, child_of=None, references=None,
 
         return otspan
 
+    @property
+    def active_span(self):
+        """Retrieves the active span from the opentracing scope manager
+
+        Falls back to using the datadog active span if one is not found. This
+        allows opentracing users to use datadog instrumentation.
+        """
+        scope = self._scope_manager.active
+        if scope:
+            return scope.span
+        else:
+            dd_span = self._dd_tracer.current_span()
+            if dd_span:
+                ot_span = Span(self, None, dd_span.name)
+                ot_span._associate_dd_span(dd_span)
+            else:
+                ot_span = None
+            return ot_span
+
     def inject(self, span_context, format, carrier):  # noqa: A002
         """Injects a span context into a carrier.
 


Test patch:
diff --git a/tests/opentracer/test_tracer.py b/tests/opentracer/test_tracer.py
--- a/tests/opentracer/test_tracer.py
+++ b/tests/opentracer/test_tracer.py
@@ -416,6 +416,11 @@ def test_start_active_span_trace(self, ot_tracer, writer):
         assert spans[2].parent_id is spans[0].span_id
         assert spans[3].parent_id is spans[2].span_id
 
+    def test_active_span(self, ot_tracer, writer):
+        with ot_tracer._dd_tracer.trace("dd") as span:
+            assert ot_tracer.active_span is not None
+            assert ot_tracer.active_span._dd_span is span
+
 
 @pytest.fixture
 def nop_span_ctx():