def tracer(): tracer = get_dummy_tracer() if sys.version_info < (3, 7): # enable legacy asyncio support from ddtrace.contrib.asyncio.provider import AsyncioContextProvider tracer.configure(context_provider=AsyncioContextProvider()) yield tracer
def tracer(): original_tracer = ddtrace.tracer tracer = get_dummy_tracer() if sys.version_info < (3, 7): # enable legacy asyncio support from ddtrace.contrib.asyncio.provider import AsyncioContextProvider tracer.configure(context_provider=AsyncioContextProvider()) setattr(ddtrace, "tracer", tracer) patch() yield tracer setattr(ddtrace, "tracer", original_tracer) unpatch()
def tracer(engine): original_tracer = ddtrace.tracer tracer = DummyTracer() if sys.version_info < (3, 7): # enable legacy asyncio support from ddtrace.contrib.asyncio.provider import AsyncioContextProvider Pin.override(engine, tracer=tracer) tracer.configure(context_provider=AsyncioContextProvider()) setattr(ddtrace, "tracer", tracer) starlette_patch() yield tracer setattr(ddtrace, "tracer", original_tracer) starlette_unpatch()